cnhis-design-vue 0.3.8-beta → 3.0.0

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +22 -22
  3. package/env.d.ts +22 -22
  4. package/es/big-table/index.css +785 -7
  5. package/es/big-table/index.js +1862 -1450
  6. package/es/button-print/index.css +811 -9
  7. package/es/button-print/index.js +705 -774
  8. package/es/drag-layout/index.css +1044 -12
  9. package/es/drag-layout/index.js +705 -774
  10. package/es/grid/index.css +1045 -12
  11. package/es/grid/index.js +32 -40
  12. package/es/index.css +1044 -12
  13. package/es/index.js +1869 -1455
  14. package/package.json +8 -3
  15. package/packages/big-table/index.ts +8 -3
  16. package/packages/big-table/src/BigTable.vue +55 -312
  17. package/packages/big-table/src/FieldSet.vue +477 -0
  18. package/packages/big-table/src/assets/style/table-base.less +77 -81
  19. package/packages/big-table/src/assets/style/table-global.less +0 -8
  20. package/packages/big-table/src/components/TextOverTooltip.vue +1 -1
  21. package/packages/big-table/src/components/edit-form/edit-select-table.vue +13 -7
  22. package/packages/big-table/src/components/edit-form/edit-select.vue +24 -3
  23. package/packages/big-table/src/hooks/useEdit.ts +73 -0
  24. package/packages/big-table/src/hooks/useFormat.ts +1 -1
  25. package/packages/big-table/src/hooks/useNestTable.ts +1 -1
  26. package/packages/big-table/src/hooks/useTableParse.ts +3 -3
  27. package/packages/big-table/src/utils.ts +1 -1
  28. package/packages/button-print/index.ts +3 -3
  29. package/packages/button-print/src/ButtonPrint.vue +2 -2
  30. package/packages/button-print/src/components/IdentityVerification.vue +1 -1
  31. package/packages/drag-layout/index.ts +3 -3
  32. package/packages/drag-layout/src/DragLayout.vue +2 -2
  33. package/packages/grid/index.ts +3 -3
  34. package/packages/grid/src/Grid.tsx +1 -1
  35. package/src/core/{create.ts → create.js} +1 -1
  36. package/src/utils/{vexutils.ts → vexutils.js} +44 -44
  37. package/tsconfig.node.json +8 -8
  38. package/packages/big-table/src/components/SvgIcon.vue +0 -49
  39. package/packages/button-print/src/utils/crypto.js +0 -25
@@ -1,8 +1,8 @@
1
1
  <script lang="tsx">
2
2
  import { defineComponent, ref, reactive } from 'vue'
3
3
  import { NSelect, NPagination, NEmpty, NSpin, NSpace } from 'naive-ui'
4
- import CGrid from '~/grid'
5
- import vexutils from '@/utils/vexutils'
4
+ import CGrid from '~/grid/index.ts'
5
+ import vexutils from '@/utils/vexutils.js'
6
6
 
7
7
  export default defineComponent({
8
8
  name: 'EditSelectTable',
@@ -29,7 +29,7 @@ export default defineComponent({
29
29
  default: ''
30
30
  }
31
31
  },
32
- emits: ['update:value'],
32
+ emits: ['update:value', 'clickSelectTable'],
33
33
  setup (props, { attrs, slots, emit }) {
34
34
  const state = reactive({
35
35
  value: props.value,
@@ -62,11 +62,12 @@ export default defineComponent({
62
62
  state.loading = false
63
63
  }
64
64
  let selectTableSearch = (value: string) => {
65
- console.log('keyword', value)
66
65
  state.keyword = value
67
66
  querySelectTableList()
68
67
  }
69
68
  selectTableSearch = vexutils.debounce(selectTableSearch, 800)
69
+ // 初始化搜索
70
+ selectTableSearch('')
70
71
  const getSelectTableGrid = () => {
71
72
  const config = {
72
73
  border: 'outer',
@@ -86,7 +87,9 @@ export default defineComponent({
86
87
  }}</CGrid>
87
88
  }
88
89
  const onCellClick = (data: any) => {
89
- emit('update:value', data.row?.[props.col.columnName]);
90
+ const { row } = data
91
+ // emit('update:value', data.row?.[props.col.columnName])
92
+ emit('clickSelectTable', row)
90
93
  state.show = false
91
94
  }
92
95
  const getPagination = () => {
@@ -97,12 +100,15 @@ export default defineComponent({
97
100
  onUpdatePage={(page: number) => querySelectTableList()}
98
101
  />
99
102
  }
100
- return <NSpace justify="space-between" align="center" style="margin-top: 5px">{[`共${state.pageCount}条`, pagination()]}</NSpace>
103
+ return <NSpace justify="space-between" align="center" style="margin-top: 5px">{{
104
+ default: () => [`共${state.pageCount}条`, pagination()]
105
+ }}</NSpace>
101
106
  }
102
107
 
103
108
  return () => [
104
109
  <NSelect
105
110
  class="form-select-table"
111
+ placeholder='请选择'
106
112
  options={[]}
107
113
  consistentMenuWidth={false}
108
114
  clearable
@@ -114,7 +120,7 @@ export default defineComponent({
114
120
  onBlur={() => state.show = false}
115
121
  onSearch={selectTableSearch}
116
122
  >{{
117
- action: () => state.loading ? <NSpace justify="center"><NSpin class="spin" size="small" /></NSpace> : [getSelectTableGrid(), state.pageCount ? getPagination() : null]
123
+ action: () => state.loading ? <NSpace justify="center">{{ default: () => <NSpin class="spin" size="small" /> }}</NSpace> : [getSelectTableGrid(), state.pageCount ? getPagination() : null]
118
124
  }}</NSelect>
119
125
  ]
120
126
  }
@@ -11,14 +11,35 @@ export default defineComponent({
11
11
  props: {
12
12
  col: {
13
13
  type: Object,
14
- default: {}
14
+ default: () => {}
15
+ },
16
+ row: {
17
+ type: Object,
18
+ default: () => {}
15
19
  }
16
20
  },
21
+ emits: ['setOptions'],
17
22
  setup (props, { attrs, slots, emit }) {
23
+
18
24
  const state = reactive({
19
- options: JSON.parse(JSON.stringify(props.col.options || []))
25
+ options: [] as any
20
26
  })
21
-
27
+ const setOptions = async () => {
28
+ if (props.col.options) {
29
+ state.options = JSON.parse(JSON.stringify(props.col.options))
30
+ } else {
31
+ // 此处需要缓存第一次请求到的options,不需要每次都请求,
32
+ // 此处的row参数应当是selectTable的row
33
+ const optionsName = `${props.col.columnName}_options`
34
+ state.options = props.row[optionsName] || await props.col.queryOptions(props.row.row)
35
+ if (!props.row[optionsName]) {
36
+ emit('setOptions', state.options)
37
+ }
38
+ }
39
+ }
40
+
41
+ setOptions()
42
+
22
43
  return () => [
23
44
  <NSelect
24
45
  {...attrs}
@@ -0,0 +1,73 @@
1
+ import { computed, ref, reactive, watch, onMounted } from 'vue'
2
+
3
+ export const useEdit = (props: any, state: any, emit: any, xGrid: any) => {
4
+ const initEditTable = async () => {
5
+ const { isEdit, fieldList } = props.columnConfig
6
+ if (!isEdit) return
7
+ const hasSelectTable = fieldList.find((v: any) => v.formType === 'selectTable')
8
+ if (!hasSelectTable) return
9
+ const record: any = {
10
+ initRow: true
11
+ }
12
+ props.columnConfig.fieldList.forEach((col: any) => {
13
+ if (col.columnName !== 'operatorColumn') {
14
+ record[col.columnName] = undefined
15
+ }
16
+ })
17
+ await xGrid.value.insertAt(record, -1)
18
+ }
19
+
20
+ const deleteRow = (row: any) => {
21
+ xGrid.value.remove(row)
22
+ }
23
+
24
+ const activeMethod = ({ row, rowIndex, column, columnIndex }: { row: any, rowIndex: number, column: any, columnIndex: number }) => {
25
+ const { isEdit, fieldList } = props.columnConfig
26
+ // console.log('activeMethod->', row, column)
27
+ if (isEdit) {
28
+ const selectTableObj = fieldList.find((v: any) => v.formType === 'selectTable')
29
+ const isEditCol = fieldList.find((v: any) => v.columnName === column.field)?.isEdit || false
30
+ if (selectTableObj) {
31
+ // const isOtherEditCol = Object.keys(row).some(v => v !== selectTableObj.columnName && v !== 'checked' && !!row[v])
32
+ if (isEditCol && ((column.field === selectTableObj.columnName && !row[column.field]) || (column.field !== selectTableObj.columnName && !row.initRow))) {
33
+ return true
34
+ } else {
35
+ return false
36
+ }
37
+ } else {
38
+ if (isEditCol) {
39
+ return true
40
+ } else {
41
+ return false
42
+ }
43
+ }
44
+ } else {
45
+ return false
46
+ }
47
+ }
48
+
49
+ const onClickSelectTable = async (row: any) => {
50
+ const record: any = {
51
+ initRow: false,
52
+ row: JSON.parse(JSON.stringify(row))
53
+ }
54
+ props.columnConfig.fieldList.forEach((col: any) => {
55
+ if (col.columnName !== 'operatorColumn') {
56
+ record[col.columnName] = undefined
57
+ if (Object.keys(row).includes(col.columnName)) {
58
+ record[col.columnName] = row[col.columnName]
59
+ }
60
+ }
61
+ })
62
+ const getInsertRecords = xGrid.value.getInsertRecords()
63
+ await xGrid.value.insertAt(record, getInsertRecords.at(-1))
64
+ xGrid.value.clearActived()
65
+ }
66
+
67
+ return {
68
+ initEditTable,
69
+ activeMethod,
70
+ deleteRow,
71
+ onClickSelectTable
72
+ }
73
+ }
@@ -1,4 +1,4 @@
1
- import vexutils from '@/utils/vexutils';
1
+ import vexutils from '@/utils/vexutils.js';
2
2
  interface Idata {
3
3
  tableList: any[];
4
4
  fieldList: any[];
@@ -1,5 +1,5 @@
1
1
  import { computed, ref, reactive, watch, onMounted } from 'vue'
2
- import vexutils from '@/utils/vexutils';
2
+ import vexutils from '@/utils/vexutils.js';
3
3
 
4
4
  export const useNestTable = (props: any, state: any, emit: any) => {
5
5
 
@@ -1,4 +1,4 @@
1
- import vexutils from '@/utils/vexutils';
1
+ import vexutils from '@/utils/vexutils.js';
2
2
 
3
3
  export const useTableParse = (formatData: Function) => {
4
4
  // DURATION - 解析时长类型
@@ -90,8 +90,8 @@ export const useTableParse = (formatData: Function) => {
90
90
  return "";
91
91
  }
92
92
 
93
- const { mergedFeildExpression } = field.settingObj;
94
- if (mergedFeildExpression) {
93
+ if (field.settingObj?.mergedFeildExpression) {
94
+ const { mergedFeildExpression } = field.settingObj
95
95
  const passList: any = [];
96
96
 
97
97
  // 合并字段
@@ -1,5 +1,5 @@
1
1
  import { nextTick } from 'vue';
2
- import vexutils from '@/utils/vexutils';
2
+ import vexutils from '@/utils/vexutils.js';
3
3
  import xb_small from './assets/img/xb_small.png';
4
4
 
5
5
  const isJSON = (str: any) => {
@@ -2,14 +2,14 @@ import type { App } from "vue";
2
2
  // 导入组件
3
3
  import ButtonPrint from "./src/ButtonPrint.vue"
4
4
 
5
- type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
5
+ // type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
6
6
 
7
7
  // 为组件提供 install 安装方法,供按需引入
8
8
  ButtonPrint.install = function(app: App) {
9
9
  app.component(ButtonPrint.name, ButtonPrint);
10
10
  };
11
11
 
12
- const CButtonPrint: SFCWithInstall<typeof ButtonPrint> = ButtonPrint; // 增加类型
12
+ // const CButtonPrint: SFCWithInstall<typeof ButtonPrint> = ButtonPrint; // 增加类型
13
13
 
14
14
  // 默认导出组件
15
- export default CButtonPrint;
15
+ export default ButtonPrint;
@@ -34,7 +34,7 @@
34
34
  </template>
35
35
 
36
36
  <script lang="ts">
37
- import create from '@/core/create';
37
+ import create from '@/core/create.js';
38
38
  export default create({
39
39
  name: "ButtonPrint"
40
40
  })
@@ -48,7 +48,7 @@ import { useMessage } from 'naive-ui'
48
48
  import type { DropdownOption } from 'naive-ui'
49
49
  import Print from './utils/print.es.min.js';
50
50
  // import vClickoutside from '@/utils/clickoutside';
51
- import vexutils from '@/utils/vexutils';
51
+ import vexutils from '@/utils/vexutils.js';
52
52
  // import type { Props } from './interfaces'
53
53
  import IdentityVerification from './components/IdentityVerification.vue';
54
54
  import axios from 'axios'
@@ -36,7 +36,7 @@ import { ref, reactive, computed, watch, onMounted, nextTick } from 'vue'
36
36
  import { NButton, NModal, NForm, NFormItem, NInput, FormRules, FormInst } from 'naive-ui'
37
37
  import { useMessage } from 'naive-ui'
38
38
  import axios from 'axios';
39
- import crypto from '../utils/crypto.js';
39
+ import crypto from '@/utils/crypto.js';
40
40
  // const crypto:any = import.meta.globEager('./utils/crypto.js');
41
41
 
42
42
  (window as any).$message = useMessage()
@@ -2,14 +2,14 @@ import type { App } from "vue";
2
2
  // 导入组件
3
3
  import DragLayout from "./src/DragLayout.vue"
4
4
 
5
- type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
5
+ // type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
6
6
 
7
7
  // 为组件提供 install 安装方法,供按需引入
8
8
  DragLayout.install = function(app: App) {
9
9
  app.component(DragLayout.name, DragLayout);
10
10
  };
11
11
 
12
- const CDragLayout: SFCWithInstall<typeof DragLayout> = DragLayout; // 增加类型
12
+ // const CDragLayout: SFCWithInstall<typeof DragLayout> = DragLayout; // 增加类型
13
13
 
14
14
  // 默认导出组件
15
- export default CDragLayout;
15
+ export default DragLayout;
@@ -245,7 +245,7 @@
245
245
  </template>
246
246
 
247
247
  <script lang="ts">
248
- import create from '@/core/create';
248
+ import create from '@/core/create.js';
249
249
  export default create({
250
250
  name: "DragLayout"
251
251
  })
@@ -257,7 +257,7 @@ import { NGrid, NGridItem, NFormItemGi, NButton, NModal, NForm, NFormItem, NInpu
257
257
  import draggable from "vuedraggable";
258
258
  import DragFormLeftItem from "./DragFormLeftItem.vue";
259
259
  import DragFormRightItem from "./DragFormRightItem.vue";
260
- import vexutils from '@/utils/vexutils';
260
+ import vexutils from '@/utils/vexutils.js';
261
261
 
262
262
  const dragLayoutContainer: any = ref(null)
263
263
  const textArea: any = ref(null)
@@ -3,7 +3,7 @@ import type { App } from "vue";
3
3
  // 导入组件
4
4
  import Grid, { VXETable } from "./src/Grid"
5
5
 
6
- type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
6
+ // type SFCWithInstall<T> = T & { install(app: App): void }; // vue 安装
7
7
 
8
8
  // 为组件提供 install 安装方法,供按需引入
9
9
  Grid.install = function(app: App) {
@@ -11,7 +11,7 @@ Grid.install = function(app: App) {
11
11
  app.use(VXETable);
12
12
  };
13
13
 
14
- const CGrid: SFCWithInstall<typeof Grid> = Grid; // 增加类型
14
+ // const CGrid: SFCWithInstall<typeof Grid> = Grid; // 增加类型
15
15
 
16
16
  // 默认导出组件
17
- export default CGrid;
17
+ export default Grid;
@@ -2,7 +2,7 @@ import { defineComponent } from "vue"
2
2
  import 'xe-utils'
3
3
  import VXETable, { Grid } from 'vxe-table'
4
4
  import 'vxe-table/lib/style.css'
5
- import create from '@/core/create';
5
+ import create from '@/core/create.js';
6
6
  import { useMethods } from './hooks'
7
7
 
8
8
  export { VXETable }
@@ -1,5 +1,5 @@
1
1
  import { KEY_COMPONENT_NAME } from '../global/variable';
2
- export default function(vm: any) {
2
+ export default function(vm) {
3
3
  vm.name = KEY_COMPONENT_NAME + (vm.name || '');
4
4
  return vm;
5
5
  }
@@ -2,7 +2,7 @@ import XEUtils from 'xe-utils';
2
2
  import moment from 'moment';
3
3
  // com内容来源于老项目
4
4
  const com = {
5
- parseCondition: function(conList: any, data: any, fieldList: any) {
5
+ parseCondition: function(conList, data, fieldList) {
6
6
  if (conList && conList.length > 0 && data && data.table) {
7
7
  for (let i = 0; i < conList.length; i++) {
8
8
  let conObj = conList[i];
@@ -19,7 +19,7 @@ const com = {
19
19
  }
20
20
  return true;
21
21
  },
22
- getFieldByKey: function(fieldKey: any, fieldList: any) {
22
+ getFieldByKey: function(fieldKey, fieldList) {
23
23
  if (fieldList && fieldList.length > 0) {
24
24
  for (let i = 0; i < fieldList.length; i++) {
25
25
  let fobj = fieldList[i];
@@ -29,7 +29,7 @@ const com = {
29
29
  }
30
30
  }
31
31
  },
32
- getConnection: function(cObj: any, fVal: any, field: any) {
32
+ getConnection: function(cObj, fVal, field) {
33
33
  let con = cObj.con;
34
34
  let value = cObj.value;
35
35
  // 修改 #['NULL','NOT_NULL'] 的判断: value => fval 2020-09-15.
@@ -340,7 +340,7 @@ const com = {
340
340
  }
341
341
  return true;
342
342
  },
343
- getBetween: function(value: any, type: any, comVal: any) {
343
+ getBetween: function(value, type, comVal) {
344
344
  if (value && value.indexOf('~') != -1 && value.split('~').length == 2) {
345
345
  let start = value.split('~')[0];
346
346
  let end = value.split('~')[1];
@@ -351,7 +351,7 @@ const com = {
351
351
  }
352
352
  }
353
353
  },
354
- convertDate: function(str: string) {
354
+ convertDate: function(str) {
355
355
  if (str) {
356
356
  if (str.indexOf('-') != -1) {
357
357
  str = str = str.replace(/-/g, '/');
@@ -371,7 +371,7 @@ const com = {
371
371
  }
372
372
  }
373
373
  },
374
- addDate: function(tempDate: any, days: any, unit: any) {
374
+ addDate: function(tempDate, days, unit) {
375
375
  let date = tempDate;
376
376
  if (['D', 'H', 'W'].includes(unit)) {
377
377
  if (tempDate && XEUtils.isValidDate(tempDate)) {
@@ -398,9 +398,9 @@ const com = {
398
398
  return new Date(date + days * 3600 * 1000);
399
399
  }
400
400
  },
401
- addDiDate: function(curDate: any, count: any, unit = 'day', type: any) {
402
- let useTime: any,
403
- res: any = {};
401
+ addDiDate: function(curDate, count, unit = 'day', type) {
402
+ let useTime,
403
+ res = {};
404
404
  let getUnit = unit.toLowerCase();
405
405
  let useUnit = getUnit + 's';
406
406
  if (type == 'add') {
@@ -427,7 +427,7 @@ const com = {
427
427
  return new Date(year + '/10/01');
428
428
  }
429
429
  },
430
- isNumber: function(val: any) {
430
+ isNumber: function(val) {
431
431
  try {
432
432
  let i = val * 1 + 100;
433
433
  if (i > 0 || i < 0 || i == 0) {
@@ -438,7 +438,7 @@ const com = {
438
438
  }
439
439
  return false;
440
440
  },
441
- isDate: function(data: any) {
441
+ isDate: function(data) {
442
442
  if (isNaN(data) && !isNaN(Date.parse(data))) {
443
443
  return true;
444
444
  }
@@ -447,7 +447,7 @@ const com = {
447
447
  };
448
448
  XEUtils.mixin({
449
449
  ...com,
450
- isJSON(str: any) {
450
+ isJSON(str) {
451
451
  if (typeof str == 'string') {
452
452
  try {
453
453
  let obj = JSON.parse(str);
@@ -466,7 +466,7 @@ XEUtils.mixin({
466
466
  * 获取按钮自定义颜色
467
467
  * @param {string} v
468
468
  */
469
- getBtnStyle(v: any) {
469
+ getBtnStyle(v) {
470
470
  // custom_bg, white_bg, none_bg
471
471
  if (v.showStyle == 'white_bg') {
472
472
  return {
@@ -490,8 +490,8 @@ XEUtils.mixin({
490
490
  };
491
491
  },
492
492
 
493
- oldColorMap(str: string) {
494
- let oldMap: any = {
493
+ oldColorMap(str) {
494
+ let oldMap = {
495
495
  blue: 'blue',
496
496
  sky: 'skyblue',
497
497
  azure: 'azure',
@@ -510,24 +510,24 @@ XEUtils.mixin({
510
510
  return oldMap[str];
511
511
  },
512
512
 
513
- validateBirthday(val: string, title: string, type: string) {
513
+ validateBirthday(val, title, type) {
514
514
  let res = true;
515
515
  if (!type) return false;
516
- let regObj: any = {
516
+ let regObj = {
517
517
  DAYReg: /^([0-9]|[1-9][0-9]|[1-2][0-9][0-9]|[3][0-5][0-9]|(360|361|363|362|364|365))$/,
518
518
  MONTHReg: /^(?:[0-9]|1[0-2])$/,
519
519
  YEARReg: /^(?:[1-9]?\d|100)$/
520
520
  };
521
521
  let testReg = `${type}Reg`;
522
522
  if (!regObj[testReg].test(+val)) {
523
- (window as any).$message.warning(`${title}${this.$t('1.9.40')}`, 2);
523
+ window.$message.warning(`${title}${this.$t('1.9.40')}`, 2);
524
524
  res = false;
525
525
  }
526
526
  return res;
527
527
  },
528
528
 
529
- handleImageSize(item: any, defaultHeight: any) {
530
- let res: any = {
529
+ handleImageSize(item, defaultHeight) {
530
+ let res = {
531
531
  display: 'inline-block',
532
532
  height: defaultHeight
533
533
  };
@@ -546,17 +546,17 @@ XEUtils.mixin({
546
546
  * @param {*} size 每次操作的数据量
547
547
  * @returns {Array}
548
548
  */
549
- handleBigArrayCopy(arr: any, size = 1000) {
549
+ handleBigArrayCopy(arr, size = 1000) {
550
550
  if (!Array.isArray(arr)) return arr;
551
551
  let cSize = size || 1000;
552
- const list: any = XEUtils.chunk(arr, cSize);
552
+ const list = XEUtils.chunk(arr, cSize);
553
553
 
554
554
  const copyFunc = (list = [], type = 'json') => {
555
- const obj: any = {
556
- json: (v: any) => JSON.parse(JSON.stringify(v)),
557
- clone: (v: any) => XEUtils.clone(v, true)
555
+ const obj = {
556
+ json: (v) => JSON.parse(JSON.stringify(v)),
557
+ clone: (v) => XEUtils.clone(v, true)
558
558
  };
559
- let copyList: any[] = [];
559
+ let copyList = [];
560
560
  list.forEach(v => {
561
561
  let rs = obj[type](v);
562
562
  copyList.push(rs);
@@ -574,7 +574,7 @@ XEUtils.mixin({
574
574
  },
575
575
 
576
576
  // color 获取 alpha
577
- getAlphafloat(a?: number, alpha?: number) {
577
+ getAlphafloat(a, alpha) {
578
578
  if (typeof a !== 'undefined') {
579
579
  return parseFloat((a / 256).toFixed(2));
580
580
  }
@@ -590,11 +590,11 @@ XEUtils.mixin({
590
590
  },
591
591
 
592
592
  // hex 转 rgba
593
- hexToRGBA(hex: any, alpha: any) {
594
- const isValidHex = (hex: any) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
595
- const getChunksFromString = (st: string, chunkSize: number) => st.match(new RegExp(`.{${chunkSize}}`, 'g'));
593
+ hexToRGBA(hex, alpha) {
594
+ const isValidHex = (hex) => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
595
+ const getChunksFromString = (st, chunkSize) => st.match(new RegExp(`.{${chunkSize}}`, 'g'));
596
596
 
597
- const convertHexUnitTo256 = (hexStr: any) => parseInt(hexStr.repeat(2 / hexStr.length), 16);
597
+ const convertHexUnitTo256 = (hexStr) => parseInt(hexStr.repeat(2 / hexStr.length), 16);
598
598
 
599
599
  if (!isValidHex(hex)) {
600
600
  console.log('Invalid HEX');
@@ -602,7 +602,7 @@ XEUtils.mixin({
602
602
  }
603
603
  const chunkSize = Math.floor((hex.length - 1) / 3);
604
604
  const hexArr = getChunksFromString(hex.slice(1), chunkSize);
605
- const [r, g, b, a] = (hexArr as any).map(convertHexUnitTo256);
605
+ const [r, g, b, a] = hexArr.map(convertHexUnitTo256);
606
606
  return {
607
607
  r: r,
608
608
  g: g,
@@ -617,7 +617,7 @@ XEUtils.mixin({
617
617
  * @param {type} type 时间戳类型
618
618
  * @param {time} time 时间戳
619
619
  */
620
- formatTime(type: string, time: string) {
620
+ formatTime(type, time) {
621
621
  let format = '';
622
622
  if (!time) return '';
623
623
  switch (type) {
@@ -647,7 +647,7 @@ XEUtils.mixin({
647
647
  }
648
648
  return XEUtils.toDateString(time, format);
649
649
  },
650
- formatDate(date: any, isShowYear: boolean = false) {
650
+ formatDate(date, isShowYear = false) {
651
651
  const today = new Date();
652
652
  const curDate = date || today.getTime();
653
653
 
@@ -670,7 +670,7 @@ XEUtils.mixin({
670
670
  return XEUtils.formatTime('MOUTHTIME', curDate);
671
671
  }
672
672
  },
673
- imgs2imgArr(imgs?: string) {
673
+ imgs2imgArr(imgs) {
674
674
  if (!imgs) return [];
675
675
 
676
676
  return imgs
@@ -679,14 +679,14 @@ XEUtils.mixin({
679
679
  })
680
680
  .split('|');
681
681
  },
682
- filterOption(input: string, option: any) {
682
+ filterOption(input, option) {
683
683
  try {
684
684
  let text = option.componentOptions.children[0].text;
685
685
  let lowText = text.toLowerCase();
686
686
  let lowInput = input.toLowerCase();
687
687
  let flag = false;
688
688
  var reg = /^[a-zA-Z]+$/;
689
- if (typeof text === 'string' && reg.test(input) && ('' as any)._toPinYin) {
689
+ if (typeof text === 'string' && reg.test(input) && ''._toPinYin) {
690
690
  flag = lowText._toPinYin().indexOf(lowInput) >= 0;
691
691
  }
692
692
  return flag || lowText.indexOf(lowInput) >= 0;
@@ -701,7 +701,7 @@ XEUtils.mixin({
701
701
  * @param {*} k key
702
702
  * @returns
703
703
  */
704
- stringToValue(item: any, k = "value") {
704
+ stringToValue(item, k = "value") {
705
705
  if (XEUtils.isString(item)) {
706
706
  if (item && item.startsWith("###{")) {
707
707
  let temp = JSON.parse(item.replace("###", ""));
@@ -711,7 +711,7 @@ XEUtils.mixin({
711
711
  return item;
712
712
  },
713
713
 
714
- notEmpty(text: any) {
714
+ notEmpty(text) {
715
715
  return XEUtils.isBoolean(text) || String(text) === "0" || !!text;
716
716
  },
717
717
 
@@ -721,16 +721,16 @@ XEUtils.mixin({
721
721
  * @param {object} obj
722
722
  * @param {string | number} noval // 没有值,默认赋值
723
723
  */
724
- handleSysParams(str: any, obj = {}, noval = "") {
724
+ handleSysParams(str, obj = {}, noval = "") {
725
725
  let p = {
726
726
  ...obj
727
727
  };
728
728
  const that = this;
729
729
  // 解析变量
730
730
  const getValList = (plsList = [], obj = {}) => {
731
- var l: any[] = [];
731
+ var l = [];
732
732
  var o = obj;
733
- plsList.forEach((v: any) => {
733
+ plsList.forEach(v => {
734
734
  let c = v;
735
735
  // xx.xx
736
736
  if (v.includes(".")) {
@@ -747,7 +747,7 @@ XEUtils.mixin({
747
747
  });
748
748
  return l;
749
749
  };
750
- const getVal = (t: any, r: any, k: any) => {
750
+ const getVal = (t, r, k) => {
751
751
  return t.replace(r, function() {
752
752
  var pKey = arguments[1];
753
753
  // 切割
@@ -786,7 +786,7 @@ export default XEUtils;
786
786
 
787
787
  export { moment };
788
788
 
789
- export function formatReleaseTime(type: string, time: any) {
789
+ export function formatReleaseTime(type, time) {
790
790
  if (time < 0) {
791
791
  return '';
792
792
  }
@@ -1,8 +1,8 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "module": "esnext",
5
- "moduleResolution": "node"
6
- },
7
- "include": ["vite.config.ts"]
8
- }
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "module": "esnext",
5
+ "moduleResolution": "node"
6
+ },
7
+ "include": ["vite.config.ts"]
8
+ }