fast-crud-ui3 1.5.16-tsc-beta → 1.5.16

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 (168) hide show
  1. package/lib/fast-crud-ui3.cjs.js +7 -7
  2. package/lib/fast-crud-ui3.es.js +1960 -2003
  3. package/lib/fast-crud-ui3.umd.js +7 -7
  4. package/lib/style.css +1 -1
  5. package/package.json +5 -18
  6. package/lib/assets/fonts/iconfont.d.ts +0 -0
  7. package/lib/components/checkbox-group/index.d.ts +0 -2
  8. package/lib/components/checkbox-group/src/fast-checkbox-group.d.ts +0 -72
  9. package/lib/components/content-dialog/index.d.ts +0 -2
  10. package/lib/components/content-dialog/src/fast-cell-content.d.ts +0 -83
  11. package/lib/components/json-viewer/index.d.ts +0 -2
  12. package/lib/components/json-viewer/src/fast-json-viewer.d.ts +0 -48
  13. package/lib/components/mapping.d.ts +0 -5
  14. package/lib/components/object-picker/index.d.ts +0 -2
  15. package/lib/components/object-picker/src/fast-object-picker.d.ts +0 -132
  16. package/lib/components/select/index.d.ts +0 -2
  17. package/lib/components/select/src/fast-select.d.ts +0 -83
  18. package/lib/components/table/index.d.ts +0 -2
  19. package/lib/components/table/src/RowConfirm.d.ts +0 -39
  20. package/lib/components/table/src/dynamic-filter-form.d.ts +0 -118
  21. package/lib/components/table/src/dynamic-filter-list.d.ts +0 -57
  22. package/lib/components/table/src/easy-filter.d.ts +0 -118
  23. package/lib/components/table/src/export-confirm.d.ts +0 -12
  24. package/lib/components/table/src/quick-filter-form.d.ts +0 -42
  25. package/lib/components/table/src/row-form.d.ts +0 -33
  26. package/lib/components/table/src/stored-filter-manager.d.ts +0 -55
  27. package/lib/components/table/src/stored-filter.d.ts +0 -37
  28. package/lib/components/table/src/table-head-cell.d.ts +0 -9
  29. package/lib/components/table/src/table.d.ts +0 -497
  30. package/lib/components/table/src/util.d.ts +0 -77
  31. package/lib/components/table-column/config.d.ts +0 -5
  32. package/lib/components/table-column/index.d.ts +0 -2
  33. package/lib/components/table-column/src/table-column.d.ts +0 -256
  34. package/lib/components/table-column-date-picker/config.d.ts +0 -5
  35. package/lib/components/table-column-date-picker/index.d.ts +0 -2
  36. package/lib/components/table-column-date-picker/src/table-column-date-picker.d.ts +0 -173
  37. package/lib/components/table-column-file/config.d.ts +0 -5
  38. package/lib/components/table-column-file/index.d.ts +0 -2
  39. package/lib/components/table-column-file/src/table-column-file.d.ts +0 -285
  40. package/lib/components/table-column-img/config.d.ts +0 -5
  41. package/lib/components/table-column-img/index.d.ts +0 -2
  42. package/lib/components/table-column-img/src/table-column-img.d.ts +0 -285
  43. package/lib/components/table-column-input/config.d.ts +0 -5
  44. package/lib/components/table-column-input/index.d.ts +0 -2
  45. package/lib/components/table-column-input/src/table-column-input.d.ts +0 -173
  46. package/lib/components/table-column-number/config.d.ts +0 -5
  47. package/lib/components/table-column-number/index.d.ts +0 -2
  48. package/lib/components/table-column-number/src/table-column-number.d.ts +0 -173
  49. package/lib/components/table-column-object/config.d.ts +0 -5
  50. package/lib/components/table-column-object/index.d.ts +0 -2
  51. package/lib/components/table-column-object/src/table-column-object.d.ts +0 -315
  52. package/lib/components/table-column-select/config.d.ts +0 -5
  53. package/lib/components/table-column-select/index.d.ts +0 -2
  54. package/lib/components/table-column-select/src/table-column-select.d.ts +0 -276
  55. package/lib/components/table-column-switch/config.d.ts +0 -5
  56. package/lib/components/table-column-switch/index.d.ts +0 -2
  57. package/lib/components/table-column-switch/src/table-column-switch.d.ts +0 -175
  58. package/lib/components/table-column-textarea/config.d.ts +0 -5
  59. package/lib/components/table-column-textarea/index.d.ts +0 -2
  60. package/lib/components/table-column-textarea/src/table-column-textarea.d.ts +0 -173
  61. package/lib/components/table-column-time-picker/config.d.ts +0 -5
  62. package/lib/components/table-column-time-picker/index.d.ts +0 -2
  63. package/lib/components/table-column-time-picker/src/table-column-time-picker.d.ts +0 -173
  64. package/lib/components/upload/index.d.ts +0 -2
  65. package/lib/components/upload/src/fast-upload.d.ts +0 -120
  66. package/lib/global.d.ts +0 -42
  67. package/lib/index.d.ts +0 -56
  68. package/lib/mixins/table-column.d.ts +0 -104
  69. package/lib/mixins/upload.d.ts +0 -15
  70. package/lib/model/cond.d.ts +0 -25
  71. package/lib/model/editComponentConfig.d.ts +0 -25
  72. package/lib/model/fastTableOption.d.ts +0 -355
  73. package/lib/model/filterComponentConfig.d.ts +0 -57
  74. package/lib/model/opt.d.ts +0 -20
  75. package/lib/model/order.d.ts +0 -7
  76. package/lib/model/pageQuery.d.ts +0 -23
  77. package/lib/model/query.d.ts +0 -33
  78. package/lib/model/rel.d.ts +0 -5
  79. package/lib/util/cache.d.ts +0 -17
  80. package/lib/util/dialog.d.ts +0 -49
  81. package/lib/util/escape.d.ts +0 -7
  82. package/lib/util/http.d.ts +0 -8
  83. package/lib/util/pick.d.ts +0 -14
  84. package/lib/util/util.d.ts +0 -252
  85. package/packages/assets/fonts/iconfont.css +0 -163
  86. package/packages/assets/fonts/iconfont.js +0 -1
  87. package/packages/assets/fonts/iconfont.ttf +0 -0
  88. package/packages/assets/fonts/iconfont.woff +0 -0
  89. package/packages/assets/fonts/iconfont.woff2 +0 -0
  90. package/packages/components/checkbox-group/index.js +0 -7
  91. package/packages/components/checkbox-group/src/fast-checkbox-group.vue +0 -83
  92. package/packages/components/content-dialog/index.js +0 -7
  93. package/packages/components/content-dialog/src/fast-cell-content.vue +0 -115
  94. package/packages/components/json-viewer/index.js +0 -7
  95. package/packages/components/json-viewer/src/fast-json-viewer.vue +0 -54
  96. package/packages/components/mapping.js +0 -95
  97. package/packages/components/object-picker/index.js +0 -7
  98. package/packages/components/object-picker/src/fast-object-picker.vue +0 -170
  99. package/packages/components/select/index.js +0 -7
  100. package/packages/components/select/src/fast-select.vue +0 -89
  101. package/packages/components/table/index.js +0 -7
  102. package/packages/components/table/src/RowConfirm.vue +0 -87
  103. package/packages/components/table/src/dynamic-filter-form.vue +0 -253
  104. package/packages/components/table/src/dynamic-filter-list.vue +0 -172
  105. package/packages/components/table/src/easy-filter.vue +0 -129
  106. package/packages/components/table/src/export-confirm.vue +0 -55
  107. package/packages/components/table/src/quick-filter-form.vue +0 -140
  108. package/packages/components/table/src/row-form.vue +0 -137
  109. package/packages/components/table/src/stored-filter-manager.vue +0 -240
  110. package/packages/components/table/src/stored-filter.vue +0 -180
  111. package/packages/components/table/src/table-head-cell.vue +0 -41
  112. package/packages/components/table/src/table.vue +0 -1309
  113. package/packages/components/table/src/util.js +0 -496
  114. package/packages/components/table-column/config.js +0 -64
  115. package/packages/components/table-column/index.js +0 -7
  116. package/packages/components/table-column/src/table-column.vue +0 -44
  117. package/packages/components/table-column-date-picker/config.js +0 -139
  118. package/packages/components/table-column-date-picker/index.js +0 -7
  119. package/packages/components/table-column-date-picker/src/table-column-date-picker.vue +0 -54
  120. package/packages/components/table-column-file/config.js +0 -83
  121. package/packages/components/table-column-file/index.js +0 -7
  122. package/packages/components/table-column-file/src/table-column-file.vue +0 -79
  123. package/packages/components/table-column-img/config.js +0 -83
  124. package/packages/components/table-column-img/index.js +0 -7
  125. package/packages/components/table-column-img/src/table-column-img.vue +0 -82
  126. package/packages/components/table-column-input/config.js +0 -77
  127. package/packages/components/table-column-input/index.js +0 -7
  128. package/packages/components/table-column-input/src/table-column-input.vue +0 -60
  129. package/packages/components/table-column-number/config.js +0 -89
  130. package/packages/components/table-column-number/index.js +0 -7
  131. package/packages/components/table-column-number/src/table-column-number.vue +0 -54
  132. package/packages/components/table-column-object/config.js +0 -66
  133. package/packages/components/table-column-object/index.js +0 -7
  134. package/packages/components/table-column-object/src/table-column-object.vue +0 -75
  135. package/packages/components/table-column-select/config.js +0 -66
  136. package/packages/components/table-column-select/index.js +0 -7
  137. package/packages/components/table-column-select/src/table-column-select.vue +0 -101
  138. package/packages/components/table-column-switch/config.js +0 -55
  139. package/packages/components/table-column-switch/index.js +0 -7
  140. package/packages/components/table-column-switch/src/table-column-switch.vue +0 -82
  141. package/packages/components/table-column-textarea/config.js +0 -77
  142. package/packages/components/table-column-textarea/index.js +0 -7
  143. package/packages/components/table-column-textarea/src/table-column-textarea.vue +0 -56
  144. package/packages/components/table-column-time-picker/config.js +0 -62
  145. package/packages/components/table-column-time-picker/index.js +0 -7
  146. package/packages/components/table-column-time-picker/src/table-column-time-picker.vue +0 -53
  147. package/packages/components/upload/index.js +0 -7
  148. package/packages/components/upload/src/fast-upload.vue +0 -272
  149. package/packages/global.d.ts +0 -42
  150. package/packages/index.js +0 -145
  151. package/packages/mixins/table-column.js +0 -133
  152. package/packages/mixins/upload.js +0 -14
  153. package/packages/model/cond.js +0 -65
  154. package/packages/model/editComponentConfig.js +0 -72
  155. package/packages/model/fastTableOption.js +0 -538
  156. package/packages/model/filterComponentConfig.js +0 -185
  157. package/packages/model/opt.js +0 -21
  158. package/packages/model/order.js +0 -16
  159. package/packages/model/pageQuery.js +0 -31
  160. package/packages/model/query.js +0 -93
  161. package/packages/model/rel.js +0 -5
  162. package/packages/style.scss +0 -5
  163. package/packages/util/cache.js +0 -92
  164. package/packages/util/dialog.js +0 -133
  165. package/packages/util/escape.js +0 -34
  166. package/packages/util/http.js +0 -18
  167. package/packages/util/pick.js +0 -92
  168. package/packages/util/util.js +0 -833
@@ -1,60 +0,0 @@
1
- <template>
2
- <el-table-column class-name="fc-table-column"
3
- :prop="prop"
4
- :label="label"
5
- :min-width="minWidth"
6
- :show-overflow-tooltip="showOverflowTooltip"
7
- v-bind="$attrs"
8
- v-if="!hidden">
9
- <template #header="{column, $index}">
10
- <fast-table-head-cell :column="columnProp" @click="headCellClick(column)">
11
- <slot name="header" v-bind:column="column" v-bind:$index="$index">
12
- <span>{{ label }}</span>
13
- </slot>
14
- </fast-table-head-cell>
15
- </template>
16
-
17
- <template #default="{row, column, $index}">
18
- <slot v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
19
- <div v-if="!canEdit(row, column, $index)">
20
- <slot name="normal" v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
21
- <fast-cell-content :value="showLabel(row)" :fat-row="row" :show-length="showLength" :linkTo="link"/>
22
- </slot>
23
- </div>
24
- <slot name="edit" v-bind:row="row" v-bind:column="column" v-bind:$index="$index" v-else>
25
- <el-input v-model="row['editRow'][prop]"
26
- v-bind="row['config'][prop]['props']"
27
- :ref="prop + $index"
28
- @change="(val) => handleChange(val, {row, column, $index})"
29
- @blur="(event) => handleBlur(event, {row, column, $index})"
30
- @focus="(event) => handleFocus(event, {row, column, $index})"
31
- @input="(val) => handleInput(val, {row, column, $index})"
32
- @clear="() => handleClear({row, column, $index})">
33
- </el-input>
34
- </slot>
35
- </slot>
36
- </template>
37
- </el-table-column>
38
- </template>
39
-
40
- <script>
41
- import tableColumn from "../../../mixins/table-column";
42
-
43
- export default {
44
- name: "FastTableColumnInput",
45
- mixins: [tableColumn],
46
- props: {
47
- minWidth: {
48
- type: String,
49
- default: () => '120px'
50
- }
51
- },
52
- data() {
53
- return {}
54
- }
55
- }
56
- </script>
57
-
58
- <style scoped>
59
-
60
- </style>
@@ -1,89 +0,0 @@
1
- import {easyOptParse, isUndefined, merge, ternary} from "../../util/util";
2
- import Opt from "../../model/opt.js";
3
-
4
- const defaultQueryConfig = {
5
- component: 'el-input',
6
- opt: Opt.LIKE,
7
- val: null, // 默认值
8
- props: {
9
- clearable: true,
10
- placeholder: '请输入..'
11
- },
12
- condMapFn: (cond) => {
13
- const operators = {
14
- '^>=': {
15
- opt: Opt.GE,
16
- valExtract: (cond) => cond.val.substring(2)
17
- },
18
- '^<=': {
19
- opt: Opt.LE,
20
- valExtract: (cond) => cond.val.substring(2)
21
- },
22
- '^!=': {
23
- opt: Opt.NE,
24
- valExtract: (cond) => cond.val.substring(2)
25
- },
26
- '^=': {
27
- opt: Opt.EQ,
28
- valExtract: (cond) => cond.val.substring(1)
29
- },
30
- '^>': {
31
- opt: Opt.GT,
32
- valExtract: (cond) => cond.val.substring(1)
33
- },
34
- '^<': {
35
- opt: Opt.LT,
36
- valExtract: (cond) => cond.val.substring(1)
37
- },
38
- '^\\*': {
39
- opt: Opt.LLIKE,
40
- valExtract: (cond) => cond.val.substring(1)
41
- },
42
- '\\*$': {
43
- opt: Opt.RLIKE,
44
- valExtract: (cond) => cond.val.substring(0, cond.val.length - 1)
45
- }
46
- }
47
- easyOptParse(cond, operators);
48
- return [cond]
49
- }
50
- }
51
- const defaultEditConfig = {
52
- component: 'el-input-number',
53
- val: undefined,
54
- props: {
55
- clearable: true,
56
- 'controls-position': "right",
57
- class: 'fc-table-inline-edit-component',
58
- editable: true,
59
- rules: []
60
- }
61
- }
62
-
63
- export default {
64
- query: (config, type) => {
65
- let val = defaultQueryConfig.val;
66
- const {props: {defaultVal, ...validProps} = {}} = config
67
- if (type === 'quick') {
68
- val = ternary(isUndefined(defaultVal), val, defaultVal);
69
- }
70
- config.val = val;
71
- config.props = validProps;
72
- return merge(config, defaultQueryConfig, true, false)
73
- },
74
- edit: (config, type) => {
75
- const {label, props = {}} = config;
76
- const {defaultVal, rules = [], ...validProps} = props;
77
- // 如果含有值不为false的required属性, 则将其转换为rules规则添加到props中
78
- if (validProps.hasOwnProperty('required') && validProps.required !== false) {
79
- rules.push({type: 'number', required: true, message: `${label}不能为空`})
80
- }
81
- config.val = ternary(isUndefined(defaultVal), defaultEditConfig.val, defaultVal);
82
- config.props = {
83
- ...validProps,
84
- rules: rules
85
- }
86
- return merge(config, defaultEditConfig, true, false);
87
- }
88
-
89
- }
@@ -1,7 +0,0 @@
1
- import FastTableColumnNumber from './src/table-column-number.vue'
2
-
3
- FastTableColumnNumber.install = (app) => {
4
- app.component(FastTableColumnNumber.name, FastTableColumnNumber)
5
- }
6
-
7
- export default FastTableColumnNumber
@@ -1,54 +0,0 @@
1
- <template>
2
- <el-table-column class-name="fc-table-column"
3
- :prop="prop"
4
- :label="label"
5
- :min-width="minWidth"
6
- :show-overflow-tooltip="showOverflowTooltip"
7
- v-bind="$attrs"
8
- v-if="!hidden">
9
- <template #header="{column, $index}">
10
- <fast-table-head-cell :column="columnProp" @click="headCellClick(column)">
11
- <slot name="header" v-bind:column="column" v-bind:$index="$index">
12
- <span>{{ label }}</span>
13
- </slot>
14
- </fast-table-head-cell>
15
- </template>
16
-
17
- <template #default="{row, column, $index}">
18
- <slot v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
19
- <div v-if="!canEdit(row, column, $index)">
20
- <slot name="normal" v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
21
- <fast-cell-content :value="showLabel(row)" :fat-row="row" :show-length="showLength" :linkTo="link"/>
22
- </slot>
23
- </div>
24
- <slot name="edit" v-bind:row="row" v-bind:column="column" v-bind:$index="$index" v-else>
25
- <el-input-number v-model="row['editRow'][prop]"
26
- v-bind="row['config'][prop]['props']"
27
- :ref="prop + $index"
28
- @change="(val) => handleChange(val, {row, column, $index})"
29
- @blur="(event) => handleBlur(event, {row, column, $index})"
30
- @focus="(event) => handleFocus(event, {row, column, $index})"></el-input-number>
31
- </slot>
32
- </slot>
33
- </template>
34
- </el-table-column>
35
- </template>
36
-
37
- <script>
38
- import tableColumn from "../../../mixins/table-column"
39
-
40
- export default {
41
- name: "FastTableColumnNumber",
42
- mixins: [tableColumn],
43
- props: {
44
- minWidth: {
45
- type: String,
46
- default: () => '90px'
47
- }
48
- }
49
- }
50
- </script>
51
-
52
- <style scoped>
53
-
54
- </style>
@@ -1,66 +0,0 @@
1
- import {isArray, isSampleType, isUndefined, merge, ternary} from "../../util/util";
2
- import Opt from '../../model/opt.js'
3
- import Cond from '../../model/cond.js'
4
- import tableColumnInputConfig from '../table-column-input/config.js'
5
-
6
- const defaultQueryConfig = {
7
- component: 'fast-object-picker',
8
- opt: Opt.EQ,
9
- val: null, // 默认值
10
- props: {
11
- clearable: true,
12
- placeholder: '请点选..',
13
- options: [] // 用以控件回显(val和label不一致时)
14
- },
15
- condMapFn: (cond) => {
16
- if (isArray(cond.val) && cond.val.length > 0) {
17
- return [new Cond(cond.col, Opt.IN, cond.val)]
18
- }
19
- if (isSampleType(cond.val)) {
20
- return [new Cond(cond.col, Opt.EQ, cond.val)]
21
- }
22
- return []
23
- }
24
- }
25
- const defaultEditConfig = {
26
- component: 'fast-object-picker',
27
- val: null,
28
- props: {
29
- class: 'fc-table-inline-edit-component',
30
- clearable: true,
31
- multiple: false, // 默认单选
32
- title: '请点选...',
33
- editable: true,
34
- options: [] // 用以控件回显(val和label不一致时)
35
- }
36
- }
37
- export default {
38
- query: (config, type) => {
39
- let val = defaultQueryConfig.val;
40
- const {props: {defaultVal, ...validProps} = {}} = config
41
- if (type === 'quick') {
42
- val = ternary(isUndefined(defaultVal), val, defaultVal);
43
- } else {
44
- // 除了快筛,其它(简筛、动筛、存筛)里输入控件都采用输入框, 否则过犹不及
45
- config.component = 'el-input'
46
- return tableColumnInputConfig.query(config, type)
47
- }
48
- config.val = val;
49
- config.props = validProps;
50
- return merge(config, defaultQueryConfig, true, false)
51
- },
52
- edit: (config, type) => {
53
- const {label, props = {}} = config;
54
- const {defaultVal, rules = [], ...validProps} = props;
55
- // 如果含有值不为false的required属性, 则将其转换为rules规则添加到props中
56
- if (validProps.hasOwnProperty('required') && validProps.required !== false) {
57
- rules.push({required: true, message: `${label}不能为空`})
58
- }
59
- config.val = ternary(isUndefined(defaultVal), defaultEditConfig.val, defaultVal);
60
- config.props = {
61
- ...validProps,
62
- rules: rules
63
- };
64
- return merge(config, defaultEditConfig, true, false)
65
- }
66
- }
@@ -1,7 +0,0 @@
1
- import FastTableColumnObject from './src/table-column-object.vue'
2
-
3
- FastTableColumnObject.install = (app) => {
4
- app.component(FastTableColumnObject.name, FastTableColumnObject)
5
- }
6
-
7
- export default FastTableColumnObject
@@ -1,75 +0,0 @@
1
- <template>
2
- <el-table-column class-name="fc-table-column"
3
- :prop="prop"
4
- :label="label"
5
- :min-width="minWidth"
6
- :show-overflow-tooltip="showOverflowTooltip"
7
- v-bind="$attrs"
8
- v-if="!hidden">
9
- <template #header="{column, $index}">
10
- <fast-table-head-cell :column="columnProp" @click="headCellClick(column)">
11
- <slot name="header" v-bind:column="column" v-bind:$index="$index">
12
- <span>{{ label }}</span>
13
- </slot>
14
- </fast-table-head-cell>
15
- </template>
16
-
17
- <template #default="{row, column, $index}">
18
- <slot v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
19
- <div v-if="!canEdit(row, column, $index)">
20
- <slot name="normal" v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
21
- <fast-cell-content :value="showLabel(row)" :fat-row="row" :show-length="showLength" :linkTo="link"/>
22
- </slot>
23
- </div>
24
- <slot name="edit" v-bind:row="row" v-bind:column="column" v-bind:$index="$index" v-else>
25
- <fast-object-picker v-model="row['editRow'][prop]"
26
- v-bind="row['config'][prop]['props']"
27
- :table-option="getTableOption(row, column, $index)"
28
- :pick-object="row['editRow']"
29
- :ref="prop + $index"
30
- @change="(val) => handleChange(val, {row, column, $index})"
31
- @blur="(event) => handleBlur(event, {row, column, $index})"
32
- @focus="(event) => handleFocus(event, {row, column, $index})"
33
- @input="(val) => handleInput(val, {row, column, $index})"
34
- @clear="() => handleClear({row, column, $index})">
35
- </fast-object-picker>
36
- </slot>
37
- </slot>
38
- </template>
39
- </el-table-column>
40
- </template>
41
-
42
- <script>
43
- import tableColumn from "../../../mixins/table-column"
44
- import {FastTableOption} from "../../../index"
45
- import {isFunction} from "../../../util/util"
46
- import FastObjectPicker from "../../object-picker/src/fast-object-picker.vue"
47
-
48
- export default {
49
- name: "FastTableColumnObject",
50
- components: {FastObjectPicker},
51
- mixins: [tableColumn],
52
- props: {
53
- minWidth: {
54
- type: String,
55
- default: () => '100px'
56
- },
57
- tableOption: {
58
- type: [FastTableOption, Function],
59
- required: true
60
- }
61
- },
62
- methods: {
63
- getTableOption(fatRow, column, $index) {
64
- if (isFunction(this.tableOption)) {
65
- return this.tableOption(fatRow, column, $index);
66
- }
67
- return this.tableOption;
68
- }
69
- }
70
- }
71
- </script>
72
-
73
- <style scoped>
74
-
75
- </style>
@@ -1,66 +0,0 @@
1
- import {isArray, isSampleType, isUndefined, merge, ternary} from "../../util/util";
2
- import Cond from '../../model/cond.js'
3
- import Opt from '../../model/opt.js'
4
-
5
- const defaultQueryConfig = {
6
- component: 'fast-select',
7
- opt: Opt.IN,
8
- val: [], // 默认值
9
- props: {
10
- clearable: true,
11
- filterable: true,
12
- multiple: true,
13
- placeholder: '请选择..'
14
- },
15
- condMapFn: (cond) => {
16
- if (isArray(cond.val) && cond.val.length > 0) {
17
- return [new Cond(cond.col, Opt.IN, cond.val)]
18
- }
19
- if (isSampleType(cond.val)) {
20
- return [new Cond(cond.col, Opt.EQ, cond.val)]
21
- }
22
- return []
23
- }
24
- }
25
- const defaultEditConfig = {
26
- component: 'fast-select',
27
- val: null,
28
- props: {
29
- clearable: true,
30
- class: 'fc-table-inline-edit-component',
31
- editable: true,
32
- rules: []
33
- }
34
- }
35
- export default {
36
- query: (config, type) => {
37
- const {props: {defaultVal, ...validProps} = {}} = config
38
- let val = []
39
- let component = 'fast-select';
40
-
41
- if (type === 'quick') {
42
- val = ternary(isUndefined(defaultVal), defaultQueryConfig.val, defaultVal);
43
- if (validProps.quickFilterCheckbox !== false) {
44
- component = 'fast-checkbox-group';
45
- }
46
- }
47
- config.val = val;
48
- config.component = component;
49
- config.props = validProps;
50
- return merge(config, defaultQueryConfig, true, false)
51
- },
52
- edit: (config, type) => {
53
- const {label, props = {}} = config;
54
- const {defaultVal, rules = [], ...validProps} = props
55
- // 如果含有值不为false的required属性, 则将其转换为rules规则添加到props中
56
- if (validProps.hasOwnProperty('required') && validProps.required !== false) {
57
- rules.push({required: true, message: `${label}不能为空`})
58
- }
59
- config.val = ternary(isUndefined(defaultVal), defaultEditConfig.val, defaultVal)
60
- config.props = {
61
- ...validProps,
62
- rules: rules
63
- }
64
- return merge(config, defaultEditConfig, true, false)
65
- }
66
- }
@@ -1,7 +0,0 @@
1
- import FastTableColumnSelect from './src/table-column-select.vue'
2
-
3
- FastTableColumnSelect.install = (app) => {
4
- app.component(FastTableColumnSelect.name, FastTableColumnSelect)
5
- }
6
-
7
- export default FastTableColumnSelect
@@ -1,101 +0,0 @@
1
- <template>
2
- <el-table-column class-name="fc-table-column"
3
- :prop="prop"
4
- :label="label"
5
- :min-width="minWidth"
6
- :show-overflow-tooltip="showOverflowTooltip"
7
- v-bind="$attrs"
8
- v-if="!hidden">
9
- <template #header="{column, $index}">
10
- <fast-table-head-cell :column="columnProp" @click="headCellClick(column)">
11
- <slot name="header" v-bind:column="column" v-bind:$index="$index">
12
- <span>{{ label }}</span>
13
- </slot>
14
- </fast-table-head-cell>
15
- </template>
16
-
17
- <template #default="{row, column, $index}">
18
- <slot v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
19
- <div v-if="!canEdit(row, column, $index)">
20
- <slot name="normal" v-bind:row="row" v-bind:column="column" v-bind:$index="$index">
21
- <fast-cell-content :value="showLabel(row)" :fat-row="row" :show-length="showLength" :linkTo="link"/>
22
- </slot>
23
- </div>
24
- <slot name="edit" v-bind:row="row" v-bind:column="column" v-bind:$index="$index" v-else>
25
- <fast-select v-model="row['editRow'][prop]"
26
- v-bind="row['config'][prop]['props']"
27
- :ref="prop + $index"
28
- @change="(val) => handleChange(val, {row, column, $index})"
29
- @blur="(event) => handleBlur(event, {row, column, $index})"
30
- @focus="(event) => handleFocus(event, {row, column, $index})"
31
- @clear="() => handleClear({row, column, $index})"
32
- @visible-change="(visible) => $emit('visibleChange', visible, {row, column, $index})"
33
- @remove-tag="(tagVal) => $emit('removeTag', tagVal, {row, column, $index})"></fast-select>
34
- </slot>
35
- </slot>
36
- </template>
37
- </el-table-column>
38
- </template>
39
-
40
- <script>
41
- import tableColumn from "../../../mixins/table-column"
42
- import FastSelect from "../../select/src/fast-select.vue"
43
- import * as util from "../../../util/util.js"
44
- import FastTableOption from '../../../model/fastTableOption.js'
45
- import Query from '../../../model/query.js'
46
-
47
- export default {
48
- name: "FastTableColumnSelect",
49
- components: {FastSelect},
50
- mixins: [tableColumn],
51
- emits: ['visibleChange', 'removeTag'],
52
- props: {
53
- minWidth: {
54
- type: String,
55
- default: () => '90px'
56
- },
57
- quickFilterCheckbox: {
58
- type: Boolean,
59
- default: () => false
60
- }
61
- },
62
- data() {
63
- return {
64
- options: []
65
- }
66
- },
67
- async created() {
68
- await this.loadOptions()
69
- },
70
- methods: {
71
- /**
72
- * 从属性中加载options(如果传入的options是FastTableOption类型, 则可能涉及异步加载)
73
- */
74
- async loadOptions() {
75
- const {options, valKey = 'value', labelKey = 'label'} = this.columnProp
76
- if (util.isArray(options)) {
77
- this.options = options
78
- } else if (options instanceof FastTableOption) {
79
- const query = new Query().setDistinct().setCols([valKey, labelKey])
80
- this.options = await options._buildSelectOptions(query, valKey, labelKey)
81
- }
82
- },
83
- showLabel(fatRow) {
84
- const {row, editRow, status, config} = fatRow
85
- const {props = {}} = config[this.prop]
86
- const {labelKey = 'label', valKey = 'value'} = props
87
- let val;
88
- if (status === 'normal') {
89
- val = row[this.prop];
90
- } else {
91
- val = editRow[this.prop];
92
- }
93
- return util.escapeLabel(val, this.options, valKey, labelKey)
94
- }
95
- }
96
- }
97
- </script>
98
-
99
- <style scoped>
100
-
101
- </style>
@@ -1,55 +0,0 @@
1
- import {merge, ternary} from "../../util/util";
2
- import Opt from "../../model/opt.js";
3
-
4
- const defaultQueryConfig = {
5
- component: 'fast-select',
6
- opt: Opt.EQ,
7
- val: null, // 默认值
8
- props: {
9
- clearable: true,
10
- options: [],
11
- }
12
- }
13
- const defaultEditConfig = {
14
- component: 'el-switch',
15
- val: null,
16
- props: {
17
- clearable: true,
18
- options: [],
19
- class: 'fc-table-inline-edit-component',
20
- editable: true,
21
- inlinePrompt: true,
22
- activeValue: true,
23
- inactiveValue: false,
24
- activeText: '是',
25
- inactiveText: '否'
26
- }
27
- }
28
- export default {
29
- query: (config, type) => {
30
- const {props: {defaultVal, ...validProps} = {}} = config
31
- const {activeValue = true, inactiveValue = false, activeText = '是', inactiveText = '否'} = validProps
32
- let val = defaultQueryConfig.val;
33
- if (type === 'quick') {
34
- val = ternary(defaultVal === inactiveValue || defaultVal === activeValue, defaultVal, val);
35
- }
36
- const options = [
37
- {label: inactiveText, value: inactiveValue},
38
- {label: activeText, value: activeValue}
39
- ]
40
- config.val = val;
41
- config.props = {
42
- ...validProps,
43
- options: options
44
- }
45
- return merge(config, defaultQueryConfig, true, false)
46
- },
47
- edit: (config, type) => {
48
- const {props: {defaultVal, ...validProps} = {}} = config
49
- const {activeValue = true, inactiveValue = false} = validProps
50
- config.val = ternary(defaultVal === inactiveValue || defaultVal === activeValue, defaultVal, inactiveValue); // 默认值合法校验
51
- config.props = validProps;
52
- return merge(config, defaultEditConfig, true, false);
53
- }
54
-
55
- }
@@ -1,7 +0,0 @@
1
- import FastTableColumnSwitch from './src/table-column-switch.vue'
2
-
3
- FastTableColumnSwitch.install = (app) => {
4
- app.component(FastTableColumnSwitch.name, FastTableColumnSwitch)
5
- }
6
-
7
- export default FastTableColumnSwitch