agilebuilder-ui 1.1.12-tmp2 → 1.1.13-tmp1

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.
@@ -35,10 +35,12 @@
35
35
  @close="closeSearchFormDialog"
36
36
  />
37
37
  <div :class="'grid-area ' + code">
38
+ <MobileCard v-if="isShowCard" :selection="selectionTableData" :columns="visibleColumns" :getColumnComponentData="getColumnComponentData" :data="tableDatas" v-model:current-page="currentPage" :page-size="pagination?.pageSizes?.[0]" :page-total="pagination?.total" @selection-change="cardSelectionChangeEvent" @current-change="handleCurrentChange" @row-dblclick="rowDblclickEvent" />
39
+
38
40
  <el-table
39
41
  v-if="refreshGrid && hasLoadedColumns"
40
42
  ref="superGrid"
41
- :data="hasFilterDataEvent ? filterGridData : gridData"
43
+ :data="tableDatas"
42
44
  :row-key="getRowKeyProp"
43
45
  :show-summary="showSummary"
44
46
  :summary-method="getSummaries"
@@ -55,7 +57,7 @@
55
57
  :span-method="rowSpan"
56
58
  :max-height="maxHeight"
57
59
  :height="tableHeight"
58
- :class="tableClass"
60
+ :class="`${tableClass} ${isShowCard ? 'xs-hidden-opacity-only' : ''}`"
59
61
  :tree-props="getTreeProps(parentProp, isSql, isLazy, dataSourceType)"
60
62
  @sort-change="handleSortChange"
61
63
  @select="selectRecord"
@@ -71,70 +73,18 @@
71
73
  @cell-dblclick="cellDblClick"
72
74
  >
73
75
  <row-detail v-if="detailColumn" :column="detailColumn" :list-code="code" @show-detail="openRowForm" />
74
- <template v-if="myCustomFormatter">
75
- <component
76
- :is="getComponentType(column)"
77
- v-for="(column, index) in visibleColumns"
78
- :ref="column.prop"
79
- :key="column.label + index"
80
- :column="column"
81
- :is-sql="isSql"
82
- :list-code="code"
83
- :custom-format="
84
- getComponentType(column) === 'GroupColumn' ? myCustomFormatter : myCustomFormatter[column.prop]
85
- "
86
- :new-width="newWidth"
87
- :drag-column-prop="dragColumnProp"
88
- :right-click-menu-arr="options.rightClickMenuArr"
89
- :table-name="tableName"
90
- :page-code="pageCode"
91
- :list-name="listName"
92
- :options="options"
93
- :pagination="pagination"
94
- :current-page="currentPage"
95
- :grid-data="isSubTableShowPage ? subTableData : gridData"
96
- :page-grid-data="isSubTableShowPage ? getSubTableGridData(subTableData) : gridData"
97
- @refresh-list="refreshList"
98
- @open-page="openPageDialog"
99
- @refresPortData="refresPortData"
100
- @refresPortsData="refresPortsData"
101
- @refresMainTableFields="refresMainTableFields"
102
- @prohibitToEdit="prohibitToEdit"
103
- />
104
- </template>
105
- <template v-else>
106
- <component
107
- :is="getComponentType(column)"
108
- v-for="(column, index) in visibleColumns"
109
- :ref="column.prop"
110
- :key="column.label + index"
111
- :is-sql="isSql"
112
- :column="column"
113
- :list-code="code"
114
- :is-line-edit="lineEdit !== null && lineEdit.editable"
115
- :new-width="newWidth"
116
- :drag-column-prop="dragColumnProp"
117
- :right-click-menu-arr="options.rightClickMenuArr"
118
- :table-name="tableName"
119
- :page-code="pageCode"
120
- :list-toolbar-form-data="listToolbarFormData"
121
- :list-name="listName"
122
- :options="options"
123
- :current-page="currentPage"
124
- :pagination="pagination"
125
- :grid-data="isSubTableShowPage ? subTableData : gridData"
126
- :page-grid-data="isSubTableShowPage ? getSubTableGridData(subTableData) : gridData"
127
- @open-page="openPageDialog"
128
- @refresData="refresData"
129
- @refresh-list="refreshList"
130
- @refresPortData="refresPortData"
131
- @refresPortsData="refresPortsData"
132
- @refresMainTableFields="refresMainTableFields"
133
- @prohibitToEdit="prohibitToEdit"
134
- />
135
- </template>
76
+
77
+ <component
78
+ :is="getComponentType(column)"
79
+ v-for="({column, ...item}, index) in visibleColumnsComponentData"
80
+ :ref="column.prop"
81
+ :key="column.label + index"
82
+ v-bind="item.$bind"
83
+ v-on="item.$on"
84
+ />
85
+
136
86
  </el-table>
137
- <div v-if="showPagination" style="position: relative; margin-top: 5px">
87
+ <div v-if="showPagination" style="position: relative; margin-top: 5px" :class="{ 'xs-hidden-opacity-only': isShowCard }">
138
88
  <el-row>
139
89
  <!-- <el-col
140
90
  v-if="
@@ -254,6 +204,7 @@ import ColumnsConfig from './columns-config.vue'
254
204
  import SearchForm from './search-form.vue'
255
205
  import searchFormDialog from './search-form-dialog.vue'
256
206
  import RowDetail from './row-detail.vue'
207
+ import MobileCard from './components/mobile-table-card.jsx'
257
208
  import { getEntityFieldValueWithOutCase, setEntityFieldValue } from '../../../src/utils/util'
258
209
  import eventBus from './eventBus'
259
210
  import {
@@ -282,6 +233,8 @@ import apis from './apis'
282
233
  import headerContextMenu from './header-context-menu.vue'
283
234
  import { isMobileBrowser, isPromise } from '../../../src/utils/common-util'
284
235
  import { checkPermission } from '../../../src/utils/permission'
236
+ import { getGuId } from '../../../src/utils/guid.js';
237
+ import resizeMixin from '../../../src/mixins/resizeMixin.js';
285
238
 
286
239
  export default {
287
240
  components: {
@@ -295,10 +248,17 @@ export default {
295
248
  searchFormDialog,
296
249
  ElIconSetting,
297
250
  ElIconRefresh,
298
- RowDetail
251
+ RowDetail,
252
+ MobileCard
299
253
  },
300
254
  name: 'SuperGrid',
255
+ mixins: [resizeMixin],
301
256
  props: {
257
+ // 是否自适应卡片
258
+ isShowAutoCard: {
259
+ type: Boolean,
260
+ default: true
261
+ },
302
262
  code: {
303
263
  type: String,
304
264
  default: ''
@@ -489,10 +449,15 @@ export default {
489
449
  currentEditRowIndex: null, // 当前查看的行记录号
490
450
  showRowForm: false, // 是否显示行记录详情
491
451
  baseURL: null,
492
- hasFilterDataEvent: false // 是否是表格过滤
452
+ hasFilterDataEvent: false, // 是否是表格过滤
453
+ selectionTableData: [], // 勾选数据
493
454
  }
494
455
  },
495
456
  computed: {
457
+ // 是否显示卡片
458
+ isShowCard() {
459
+ return this.isShowAutoCard && this.isMobileResize
460
+ },
496
461
  visibleColumns() {
497
462
  const gridParams = store.get(this.code)
498
463
  const operations = this.getOptionOperations()
@@ -555,6 +520,15 @@ export default {
555
520
  })
556
521
  }
557
522
  },
523
+ visibleColumnsComponentData() {
524
+ return this.visibleColumns.map(data => this.getColumnComponentData(data, this.myCustomFormatter))
525
+ },
526
+ mobileColumns() {
527
+ return 'Layout'
528
+ },
529
+ tableDatas() {
530
+ return this.hasFilterDataEvent ? this.filterGridData : this.gridData
531
+ },
558
532
  spanArr() {
559
533
  const spanArr = []
560
534
  for (const column of this.columns) {
@@ -597,6 +571,24 @@ export default {
597
571
  // }
598
572
  },
599
573
  watch: {
574
+ // 是否为移动端尺寸
575
+ 'isMobileResize': {
576
+ deep: true,
577
+ handler() {
578
+ // 是否开启卡片,如果开启则平台切换时候重新回到第一页
579
+ if(this.isShowAutoCard) {
580
+ this.currentPage = 1
581
+ this.handleCurrentChange()
582
+ }
583
+ }
584
+ },
585
+ 'tableDatas': {
586
+ deep: true,
587
+ immediate: true,
588
+ handler(a, b) {
589
+ console.log('SGQ --- 表格监听数据修改============================》', a, b)
590
+ }
591
+ },
600
592
  'options.SuperGrid': {
601
593
  deep: true,
602
594
  handler: function () {
@@ -1737,11 +1729,13 @@ export default {
1737
1729
  .post(requestUrl, param)
1738
1730
  .then((data) => {
1739
1731
  if (typeof parentRowIds === 'undefined' || parentRowIds === null) {
1732
+ // 当开启卡片的时候,则开启滚动分页
1733
+ const dataList = [...(this.isShowCard && this.currentPage > 1 ? this.gridData : []),...(data?.data ?? []).map(item => ({$rowDataGuId: getGuId(), ...item}))]
1740
1734
  let tableData = []
1741
1735
  // 对数据做序列化,比如:处理xss攻击
1742
1736
  if (isHasOptionFunction('gridDataLoaded', this.code)) {
1743
1737
  const gridDataLoadedParam = {
1744
- gridData: data.data,
1738
+ gridData: dataList,
1745
1739
  columns: gridParams.columns,
1746
1740
  additionalParamMap: gridParams.additionalParamMap,
1747
1741
  pageContext: this.pageContext,
@@ -1755,10 +1749,10 @@ export default {
1755
1749
  if (gridData) {
1756
1750
  tableData = gridData
1757
1751
  } else {
1758
- tableData = data.data
1752
+ tableData = dataList
1759
1753
  }
1760
1754
  } else {
1761
- tableData = data.data
1755
+ tableData = dataList
1762
1756
  }
1763
1757
  if (!tableData) {
1764
1758
  tableData = []
@@ -2164,8 +2158,7 @@ export default {
2164
2158
  },
2165
2159
  getSearchParam() {
2166
2160
  const searchParam = {
2167
- code: this.code,
2168
- tableName: this.tableName
2161
+ code: this.code
2169
2162
  }
2170
2163
  const gridParams = store.get(this.code)
2171
2164
  const pagination = this.getPaginationInfo()
@@ -2271,6 +2264,7 @@ export default {
2271
2264
  }
2272
2265
  },
2273
2266
  changePage() {
2267
+ console.log('点击了分页')
2274
2268
  // 翻页操作会导致筛选项发生变化,所以需要清空已有的
2275
2269
  this.$refs.superGrid.clearFilter()
2276
2270
  // TODO: 把当前页数、每页条数、查询条件、排序信息传回后台
@@ -2739,6 +2733,7 @@ export default {
2739
2733
  return this.isSubTableShowPage ? this.subTableData : this.gridData
2740
2734
  },
2741
2735
  rowDblclickEvent(row, column, event) {
2736
+ console.log('+++++++++++++++++++++++++++++++++', row, column, event)
2742
2737
  const gridParams = store.get(this.code)
2743
2738
  if (gridParams.options && gridParams.options.isFormSubTable && gridParams.options.isPdfEditor) {
2744
2739
  // 如果是子表并且是pdf模式
@@ -2778,6 +2773,7 @@ export default {
2778
2773
  }
2779
2774
  } else {
2780
2775
  if (row) {
2776
+ debugger;
2781
2777
  if (gridParams && gridParams.lineEdit && gridParams.lineEdit.editable && gridParams.canntEdit) {
2782
2778
  let index = this.gridData.findIndex(function (item) {
2783
2779
  return (item.id && item.id === row.id) || (item.ID && item.ID === row.ID)
@@ -2785,6 +2781,7 @@ export default {
2785
2781
  if (index < 0) {
2786
2782
  index = 0
2787
2783
  }
2784
+ console.log('我点击了。。。。。。。。。。。。。。。。。。。', index, this.code)
2788
2785
  this.editRow(index, this.code)
2789
2786
  }
2790
2787
  }
@@ -2792,6 +2789,7 @@ export default {
2792
2789
  this.rowDblClick(row, column, event)
2793
2790
  },
2794
2791
  rowDbClickEditRow(gridParams, row) {
2792
+ console.log('rowDbClickEditRow+++++++++++++++++++', gridParams, row)
2795
2793
  // 取消上一行的编辑状态
2796
2794
  let editRows
2797
2795
  if (this.isSubTableShowPage) {
@@ -2973,6 +2971,7 @@ export default {
2973
2971
  * @param entity 格式如:{'NAME':false,"DYM_COLUMN":true}。表示NAME字段不可编辑,DYM_COLUMN可以被编辑
2974
2972
  */
2975
2973
  prohibitToEdit(entity) {
2974
+ console.log('我执行了 prohibitToEdit=================================》', entity)
2976
2975
  this.fnProhibitToEdit(entity)
2977
2976
  },
2978
2977
  // 树形结构时数据展示
@@ -3013,6 +3012,8 @@ export default {
3013
3012
  },
3014
3013
  // 选择记录
3015
3014
  selectRecord(selection, row) {
3015
+ console.log('selectRecord====>', selection, row)
3016
+ this.selectionTableData = row
3016
3017
  let selectRecordEventResult = true
3017
3018
  const gridParams = store.get(this.code)
3018
3019
  if (isHasOptionFunction('selectRecord', this.code)) {
@@ -3034,9 +3035,11 @@ export default {
3034
3035
  }
3035
3036
  }
3036
3037
  this.select(selection, row)
3038
+ console.log('查看页面数据', this, gridParams.options, this.row, this.selection)
3037
3039
  },
3038
3040
  // 取消选择记录
3039
3041
  selectAllRecord(selection) {
3042
+ console.log('selectAllRecord====>', selection)
3040
3043
  let selectAllRecordsEventResult = true
3041
3044
  const gridParams = store.get(this.code)
3042
3045
  if (isHasOptionFunction('selectAllRecords', this.code)) {
@@ -3058,8 +3061,22 @@ export default {
3058
3061
  }
3059
3062
  this.selectAll(selection)
3060
3063
  },
3064
+ cardSelectionChangeEvent(newSelection) {
3065
+ try {
3066
+ this.$refs.superGrid.clearSelection()
3067
+ for(const i in newSelection) {
3068
+ const row = newSelection[i]
3069
+ this.$refs.superGrid.toggleRowSelection(row, true)
3070
+ }
3071
+ } catch (error) {
3072
+ console.error(error)
3073
+ }
3074
+ this.selectionChangeEvent(newSelection)
3075
+ },
3061
3076
  // 选择记录发生改变时
3062
3077
  selectionChangeEvent(newSelection) {
3078
+ this.selectionTableData = newSelection
3079
+ console.log('selectionChangeEvent====>', newSelection)
3063
3080
  const gridParams = store.get(this.code)
3064
3081
  if (isHasOptionFunction('selectionChange', this.code)) {
3065
3082
  gridParams.options.selectionChange.call(this, {
@@ -3175,6 +3192,57 @@ export default {
3175
3192
  } else {
3176
3193
  return prop
3177
3194
  }
3195
+ },
3196
+ getColumnComponentData(column, myCustomFormatter) {
3197
+ try {
3198
+ // if (!['[object Object]'].includes(Object.prototype.toString.call(column))) throw new Error('no column');
3199
+ const componentType = this.getComponentType(column)
3200
+ return {
3201
+ column,
3202
+ getComponentType: this.getComponentType,
3203
+ customFormat: myCustomFormatter,
3204
+ // props + attrs 参数
3205
+ $bind: {
3206
+ column,
3207
+ 'ref': column.prop,
3208
+ // 'is': componentType,
3209
+ 'is-sql': this.isSql,
3210
+ 'list-code': this.code,
3211
+ 'new-width': this.newWidth,
3212
+ 'drag-column-prop': this.dragColumnProp,
3213
+ 'right-click-menu-arr': this.options?.rightClickMenuArr,
3214
+ 'table-name': this.tableName,
3215
+ 'page-code': this.pageCode,
3216
+ 'list-name': this.listName,
3217
+ 'options': this.options,
3218
+ 'current-page': this.currentPage,
3219
+ 'pagination': this.pagination,
3220
+ 'grid-data': this.isSubTableShowPage ? this.subTableData : this.gridData,
3221
+ 'page-grid-data': this.isSubTableShowPage ? this.getSubTableGridData(this.subTableData) : this.gridData,
3222
+ ...(myCustomFormatter ? {
3223
+ 'custom-format': ['GroupColumn'].includes(componentType) ? myCustomFormatter : myCustomFormatter[column.prop],
3224
+ } : {
3225
+ 'is-line-edit': this.lineEdit?.editable ?? false,
3226
+ 'list-toolbar-form-data': this.listToolbarFormData,
3227
+ }),
3228
+ },
3229
+ // 事件绑定
3230
+ $on: {
3231
+ 'open-page': this.openPageDialog,
3232
+ 'refresData': this.refresData,
3233
+ 'refresh-list': this.refreshList,
3234
+ 'refresPortData': this.refresPortData,
3235
+ 'refresPortsData': this.refresPortsData,
3236
+ 'refresMainTableFields': this.refresMainTableFields,
3237
+ 'prohibitToEdit': this.prohibitToEdit,
3238
+ }
3239
+ }
3240
+ } catch (error) {
3241
+ console.error(error)
3242
+ return {
3243
+ column
3244
+ }
3245
+ }
3178
3246
  }
3179
3247
  },
3180
3248
  emits: [
@@ -0,0 +1,49 @@
1
+ export default {
2
+ data() {
3
+ const element = document.querySelector('.amb-design-board');
4
+ let designObserver
5
+ if (element) {
6
+ this.designObserver = new ResizeObserver(entries => {
7
+ for (const entry of entries) {
8
+ console.log(entry);
9
+ this.handleDesignResize(entry?.['target'])
10
+ }
11
+ });
12
+ designObserver.observe(element);
13
+ }
14
+ return {
15
+ windowWidth: designObserver ? element.clientWidth : window.innerWidth,
16
+ windowHeight: designObserver ? element.clientHeight : window.innerHeight,
17
+ designObserver
18
+ };
19
+ },
20
+ computed: {
21
+ isMobileResize() {
22
+ return (this.windowWidth ?? 0) <= 768
23
+ }
24
+ },
25
+ mounted() {
26
+ if (!this.designObserver) {
27
+ window.addEventListener('resize', this.handleWindowResize);
28
+ }
29
+ },
30
+ beforeDestroy() {
31
+ if (this.designObserver) {
32
+ this.designObserver.disconnect();
33
+ } else {
34
+ window.removeEventListener('resize', this.handleWindowResize);
35
+ }
36
+ },
37
+ methods: {
38
+ handleWindowResize() {
39
+ this.windowWidth = window.innerWidth;
40
+ this.windowHeight = window.innerHeight;
41
+ },
42
+ handleDesignResize(element) {
43
+ if (element) {
44
+ this.windowWidth = element.clientWidth;
45
+ this.windowHeight = element.clientHeight;
46
+ }
47
+ }
48
+ }
49
+ };
@@ -1,3 +1,5 @@
1
+ import System from "@zxing/library/esm/core/util/System"
2
+
1
3
  const app = {
2
4
  state: {
3
5
  sidebar: {
@@ -7,8 +9,20 @@ const app = {
7
9
  device: 'desktop',
8
10
  preventReclick: false,
9
11
  whiteList: [],
12
+ systemWidth: [],
13
+ windowWidth: window.innerWidth,
14
+ windowHeight: window.innerHeight,
15
+ targetDomWidth: 0,
16
+ isModel: false,
10
17
  },
11
18
  mutations: {
19
+ updateWindowSize(state, { width, height }) {
20
+ state.windowWidth = width;
21
+ state.windowHeight = height;
22
+ },
23
+ updateTargetDomWidth(state, width) {
24
+ state.targetDomWidth = width;
25
+ },
12
26
  toggleSidebar: (state) => {
13
27
  if (state.sidebar.opened) {
14
28
  window.sessionStorage.setItem('sidebarStatus', 1)
@@ -36,6 +50,18 @@ const app = {
36
50
  },
37
51
  },
38
52
  actions: {
53
+ startListeningToResize({ commit }) {
54
+ const handleResize = () => {
55
+ commit('updateWindowSize', {
56
+ width: window.innerWidth,
57
+ height: window.innerHeight
58
+ });
59
+ };
60
+ window.addEventListener('resize', handleResize);
61
+ return () => {
62
+ window.removeEventListener('resize', handleResize);
63
+ };
64
+ },
39
65
  toggleSidebar: ({ commit }) => {
40
66
  commit('toggleSidebar')
41
67
  },
@@ -32,3 +32,135 @@
32
32
  box-shadow: 0px 1px 8px 0px #00000019;
33
33
  }
34
34
  }
35
+
36
+ [overflow-wrap] {
37
+ word-wrap: break-word;
38
+ overflow-wrap: break-word;
39
+ }
40
+
41
+ .yx-flex-wrap {
42
+ display: flex;
43
+ justify-content: flex-start;
44
+ &[vertical] {
45
+ flex-direction: column;
46
+ }
47
+ &[justify='space-between'] {
48
+ justify-content: space-between;
49
+ }
50
+ &[align='center'] {
51
+ align-items: center;
52
+ }
53
+ &[wrap] {
54
+ flex-wrap: wrap;
55
+ }
56
+ }
57
+
58
+ .el-descriptions {
59
+ &[layout='form'] {
60
+ .el-descriptions__cell {
61
+ display: flex;
62
+ gap: 10px;
63
+ .el-descriptions__label {
64
+ margin: 0;
65
+ max-width: 40%;
66
+ flex: 0 0 auto;
67
+ }
68
+ .el-descriptions__content {
69
+ flex: 1 1 auto;
70
+ word-wrap: break-word;
71
+ overflow-wrap: break-word;
72
+
73
+ .ellipsis {
74
+ word-wrap: break-word !important;
75
+ overflow-wrap: break-word !important;
76
+ width: auto !important;
77
+ white-space: inherit !important;
78
+ }
79
+ }
80
+ @media (max-width: 450px) {
81
+ & {
82
+ flex-direction: column;
83
+ }
84
+ .el-descriptions__label {
85
+ width: 100% !important;
86
+ max-width: 100%;
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ .yx-card-main {
94
+ &.is-checked {
95
+ border-color: #409eff;
96
+ }
97
+ &[header-padding] {
98
+ & > .el-card__header {
99
+ padding: 0 !important;
100
+ }
101
+ }
102
+ &[body-padding] {
103
+ & > .el-card__body {
104
+ padding: 0 !important;
105
+ }
106
+ }
107
+ .el-card__header {
108
+ & > .yx-flex-wrap {
109
+ flex: 1 1 auto;
110
+ }
111
+ }
112
+ }
113
+
114
+ [scrollable-main] {
115
+ position: relative;
116
+ &:has(.el-scrollbar__wrap:has(::-webkit-scrollbar-thumb:vertical)):not(:has(.el-scrollbar__wrap:has(:first-child:has(+ *))))::before {
117
+ content: " ";
118
+ position: absolute;
119
+ top: 0;
120
+ left: 0;
121
+ right: 0;
122
+ height: 10px;
123
+ background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
124
+ pointer-events: none;
125
+ }
126
+
127
+ /* 底部阴影 */
128
+ &:has(.el-scrollbar__wrap:has(::-webkit-scrollbar-thumb:vertical)):not(:has(.el-scrollbar__wrap:has(:last-child:has(+ *))))::after {
129
+ content: " ";
130
+ position: absolute;
131
+ bottom: 0;
132
+ left: 0;
133
+ right: 0;
134
+ height: 10px;
135
+ background: linear-gradient(to top, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
136
+ pointer-events: none;
137
+ }
138
+ }
139
+
140
+ [loading-rotate] {
141
+ animation: loading-rotate 2s linear infinite;
142
+ }
143
+
144
+ @keyframes loading-rotate {
145
+ to {
146
+ transform:rotate(360deg)
147
+ }
148
+ }
149
+
150
+ .isHideTable {
151
+ opacity: 0 !important;
152
+ z-index: -99 !important;
153
+ width: 0px !important;
154
+ height: 0px !important;
155
+ overflow: hidden !important;
156
+ }
157
+
158
+ .xs-hidden-opacity-only {
159
+ @media (max-width: 768px) {
160
+ opacity: 0 !important;
161
+ z-index: -99 !important;
162
+ width: 0px !important;
163
+ height: 0px !important;
164
+ overflow: hidden !important;
165
+ }
166
+ }
@@ -19,6 +19,7 @@
19
19
  @import "./table.scss";
20
20
  @import './theme/tiffany-blue-mobile/index.scss';
21
21
  @import './theme/tiffany-blue-mobile/sidebar.scss';
22
+ @import 'element-plus/theme-chalk/display.css';
22
23
 
23
24
  body {
24
25
  overflow: hidden;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 获取4位随机数
3
+ */
4
+ export function getS4(a, b, c, d) {
5
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
6
+ }
7
+
8
+ /**
9
+ * 生成GuId
10
+ */
11
+ export function getGuId(data = `{s}{s}-{s}-{s}-{s}-{s}{s}{s}`) {
12
+ return data.replace(/{(y|m|d|h|i|s|a)+}/g, getS4)
13
+ }
package/vite.config.js CHANGED
@@ -1,17 +1,24 @@
1
1
  import { defineConfig } from "vite";
2
2
  import vue from "@vitejs/plugin-vue";
3
3
  import path from "path";
4
- // import { terser } from 'rollup-plugin-terser'
4
+ import { terser } from 'rollup-plugin-terser'
5
+ import vueJsx from '@vitejs/plugin-vue-jsx';
6
+
5
7
  // https://vitejs.dev/config/
6
- export default defineConfig({
8
+ export default defineConfig(({ mode }) => ({
7
9
  plugins: [
8
- vue()
9
- // terser({
10
- // output: {
11
- // // 对于console.error,不做任何处理
12
- // comments: (node, comment) => comment.type === 'error'
13
- // }
14
- // })
10
+ vue(),
11
+ vueJsx(),
12
+ terser({
13
+ compress: {
14
+ drop_console: ['production'].includes(mode),
15
+ drop_debugger: ['production'].includes(mode),
16
+ },
17
+ output: {
18
+ // 对于console.error,不做任何处理
19
+ comments: (node, comment) => comment.type === 'error'
20
+ }
21
+ })
15
22
  ],
16
23
  build: {
17
24
  outDir: "lib", //输出文件名称
@@ -22,7 +29,7 @@ export default defineConfig({
22
29
  }, //库编译模式配置
23
30
  rollupOptions: {
24
31
  // 确保外部化处理那些你不想打包进库的依赖
25
- external: ["vue"],
32
+ external: ["vue", "jsx"],
26
33
  output: {
27
34
  // 在 UMD 构建模式下为这些外部化的依赖提供一个全局变量
28
35
  globals: {
@@ -36,11 +43,12 @@ export default defineConfig({
36
43
  },
37
44
  },
38
45
  }, // rollup打包配置
46
+ sourcemap: mode === 'development'
39
47
  },
40
48
  // ...其他配置项
41
49
  resolve: {
42
50
  // 忽略后缀名的配置选项, 添加 .vue 选项时要记得原本默认忽略的选项也要手动写入
43
51
  extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue']
44
52
  }
45
- });
53
+ }));
46
54