fast-crud-ui3 1.5.16 → 1.5.18-beta

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/assets/fonts/iconfont.d.ts +0 -0
  2. package/lib/components/checkbox-group/index.d.ts +2 -0
  3. package/lib/components/checkbox-group/src/fast-checkbox-group.d.ts +72 -0
  4. package/lib/components/content-dialog/index.d.ts +2 -0
  5. package/lib/components/content-dialog/src/fast-cell-content.d.ts +83 -0
  6. package/lib/components/json-viewer/index.d.ts +2 -0
  7. package/lib/components/json-viewer/src/fast-json-viewer.d.ts +48 -0
  8. package/lib/components/mapping.d.ts +5 -0
  9. package/lib/components/object-picker/index.d.ts +2 -0
  10. package/lib/components/object-picker/src/fast-object-picker.d.ts +132 -0
  11. package/lib/components/select/index.d.ts +2 -0
  12. package/lib/components/select/src/fast-select.d.ts +83 -0
  13. package/lib/components/table/index.d.ts +2 -0
  14. package/lib/components/table/src/RowConfirm.d.ts +39 -0
  15. package/lib/components/table/src/dynamic-filter-form.d.ts +118 -0
  16. package/lib/components/table/src/dynamic-filter-list.d.ts +57 -0
  17. package/lib/components/table/src/easy-filter.d.ts +118 -0
  18. package/lib/components/table/src/export-confirm.d.ts +12 -0
  19. package/lib/components/table/src/quick-filter-form.d.ts +42 -0
  20. package/lib/components/table/src/row-form.d.ts +33 -0
  21. package/lib/components/table/src/stored-filter-manager.d.ts +55 -0
  22. package/lib/components/table/src/stored-filter.d.ts +37 -0
  23. package/lib/components/table/src/table-head-cell.d.ts +9 -0
  24. package/lib/components/table/src/table.d.ts +507 -0
  25. package/lib/components/table/src/util.d.ts +77 -0
  26. package/lib/components/table-column/config.d.ts +5 -0
  27. package/lib/components/table-column/index.d.ts +2 -0
  28. package/lib/components/table-column/src/table-column.d.ts +256 -0
  29. package/lib/components/table-column-date-picker/config.d.ts +5 -0
  30. package/lib/components/table-column-date-picker/index.d.ts +2 -0
  31. package/lib/components/table-column-date-picker/src/table-column-date-picker.d.ts +173 -0
  32. package/lib/components/table-column-file/config.d.ts +5 -0
  33. package/lib/components/table-column-file/index.d.ts +2 -0
  34. package/lib/components/table-column-file/src/table-column-file.d.ts +285 -0
  35. package/lib/components/table-column-img/config.d.ts +5 -0
  36. package/lib/components/table-column-img/index.d.ts +2 -0
  37. package/lib/components/table-column-img/src/table-column-img.d.ts +285 -0
  38. package/lib/components/table-column-input/config.d.ts +5 -0
  39. package/lib/components/table-column-input/index.d.ts +2 -0
  40. package/lib/components/table-column-input/src/table-column-input.d.ts +173 -0
  41. package/lib/components/table-column-number/config.d.ts +5 -0
  42. package/lib/components/table-column-number/index.d.ts +2 -0
  43. package/lib/components/table-column-number/src/table-column-number.d.ts +173 -0
  44. package/lib/components/table-column-object/config.d.ts +5 -0
  45. package/lib/components/table-column-object/index.d.ts +2 -0
  46. package/lib/components/table-column-object/src/table-column-object.d.ts +315 -0
  47. package/lib/components/table-column-select/config.d.ts +5 -0
  48. package/lib/components/table-column-select/index.d.ts +2 -0
  49. package/lib/components/table-column-select/src/table-column-select.d.ts +276 -0
  50. package/lib/components/table-column-switch/config.d.ts +5 -0
  51. package/lib/components/table-column-switch/index.d.ts +2 -0
  52. package/lib/components/table-column-switch/src/table-column-switch.d.ts +175 -0
  53. package/lib/components/table-column-textarea/config.d.ts +5 -0
  54. package/lib/components/table-column-textarea/index.d.ts +2 -0
  55. package/lib/components/table-column-textarea/src/table-column-textarea.d.ts +173 -0
  56. package/lib/components/table-column-time-picker/config.d.ts +5 -0
  57. package/lib/components/table-column-time-picker/index.d.ts +2 -0
  58. package/lib/components/table-column-time-picker/src/table-column-time-picker.d.ts +173 -0
  59. package/lib/components/upload/index.d.ts +2 -0
  60. package/lib/components/upload/src/fast-upload.d.ts +120 -0
  61. package/lib/fast-crud-ui3.cjs.js +44 -17
  62. package/lib/fast-crud-ui3.es.js +9991 -5946
  63. package/lib/fast-crud-ui3.umd.js +44 -17
  64. package/lib/global.d.ts +42 -0
  65. package/lib/index.d.ts +56 -0
  66. package/lib/mixins/table-column.d.ts +104 -0
  67. package/lib/mixins/upload.d.ts +15 -0
  68. package/lib/model/cond.d.ts +48 -0
  69. package/lib/model/editComponentConfig.d.ts +25 -0
  70. package/lib/model/fastTableOption.d.ts +513 -0
  71. package/lib/model/filterComponentConfig.d.ts +55 -0
  72. package/lib/model/opt.d.ts +20 -0
  73. package/lib/model/order.d.ts +28 -0
  74. package/lib/model/pageQuery.d.ts +43 -0
  75. package/lib/model/query.d.ts +101 -0
  76. package/lib/model/rel.d.ts +5 -0
  77. package/lib/style.css +1 -1
  78. package/lib/util/cache.d.ts +17 -0
  79. package/lib/util/dialog.d.ts +49 -0
  80. package/lib/util/escape.d.ts +7 -0
  81. package/lib/util/http.d.ts +8 -0
  82. package/lib/util/pick.d.ts +9 -0
  83. package/lib/util/util.d.ts +311 -0
  84. package/package.json +19 -5
  85. package/packages/assets/fonts/iconfont.css +163 -0
  86. package/packages/assets/fonts/iconfont.js +1 -0
  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 +7 -0
  91. package/packages/components/checkbox-group/src/fast-checkbox-group.vue +83 -0
  92. package/packages/components/content-dialog/index.js +7 -0
  93. package/packages/components/content-dialog/src/fast-cell-content.vue +115 -0
  94. package/packages/components/json-viewer/index.js +7 -0
  95. package/packages/components/json-viewer/src/fast-json-viewer.vue +54 -0
  96. package/packages/components/mapping.js +95 -0
  97. package/packages/components/object-picker/index.js +7 -0
  98. package/packages/components/object-picker/src/fast-object-picker.vue +170 -0
  99. package/packages/components/select/index.js +7 -0
  100. package/packages/components/select/src/fast-select.vue +90 -0
  101. package/packages/components/table/index.js +7 -0
  102. package/packages/components/table/src/RowConfirm.vue +87 -0
  103. package/packages/components/table/src/dynamic-filter-form.vue +253 -0
  104. package/packages/components/table/src/dynamic-filter-list.vue +172 -0
  105. package/packages/components/table/src/easy-filter.vue +129 -0
  106. package/packages/components/table/src/export-confirm.vue +55 -0
  107. package/packages/components/table/src/quick-filter-form.vue +140 -0
  108. package/packages/components/table/src/row-form.vue +137 -0
  109. package/packages/components/table/src/stored-filter-manager.vue +240 -0
  110. package/packages/components/table/src/stored-filter.vue +180 -0
  111. package/packages/components/table/src/table-head-cell.vue +41 -0
  112. package/packages/components/table/src/table.vue +1309 -0
  113. package/packages/components/table/src/util.js +496 -0
  114. package/packages/components/table-column/config.js +64 -0
  115. package/packages/components/table-column/index.js +7 -0
  116. package/packages/components/table-column/src/table-column.vue +44 -0
  117. package/packages/components/table-column-date-picker/config.js +139 -0
  118. package/packages/components/table-column-date-picker/index.js +7 -0
  119. package/packages/components/table-column-date-picker/src/table-column-date-picker.vue +54 -0
  120. package/packages/components/table-column-file/config.js +83 -0
  121. package/packages/components/table-column-file/index.js +7 -0
  122. package/packages/components/table-column-file/src/table-column-file.vue +79 -0
  123. package/packages/components/table-column-img/config.js +83 -0
  124. package/packages/components/table-column-img/index.js +7 -0
  125. package/packages/components/table-column-img/src/table-column-img.vue +82 -0
  126. package/packages/components/table-column-input/config.js +77 -0
  127. package/packages/components/table-column-input/index.js +7 -0
  128. package/packages/components/table-column-input/src/table-column-input.vue +60 -0
  129. package/packages/components/table-column-number/config.js +89 -0
  130. package/packages/components/table-column-number/index.js +7 -0
  131. package/packages/components/table-column-number/src/table-column-number.vue +54 -0
  132. package/packages/components/table-column-object/config.js +66 -0
  133. package/packages/components/table-column-object/index.js +7 -0
  134. package/packages/components/table-column-object/src/table-column-object.vue +75 -0
  135. package/packages/components/table-column-select/config.js +67 -0
  136. package/packages/components/table-column-select/index.js +7 -0
  137. package/packages/components/table-column-select/src/table-column-select.vue +101 -0
  138. package/packages/components/table-column-switch/config.js +55 -0
  139. package/packages/components/table-column-switch/index.js +7 -0
  140. package/packages/components/table-column-switch/src/table-column-switch.vue +82 -0
  141. package/packages/components/table-column-textarea/config.js +77 -0
  142. package/packages/components/table-column-textarea/index.js +7 -0
  143. package/packages/components/table-column-textarea/src/table-column-textarea.vue +56 -0
  144. package/packages/components/table-column-time-picker/config.js +62 -0
  145. package/packages/components/table-column-time-picker/index.js +7 -0
  146. package/packages/components/table-column-time-picker/src/table-column-time-picker.vue +53 -0
  147. package/packages/components/upload/index.js +7 -0
  148. package/packages/components/upload/src/fast-upload.vue +272 -0
  149. package/packages/global.d.ts +42 -0
  150. package/packages/index.js +145 -0
  151. package/packages/mixins/table-column.js +133 -0
  152. package/packages/mixins/upload.js +14 -0
  153. package/packages/model/cond.js +74 -0
  154. package/packages/model/editComponentConfig.js +72 -0
  155. package/packages/model/fastTableOption.js +769 -0
  156. package/packages/model/filterComponentConfig.js +191 -0
  157. package/packages/model/opt.js +21 -0
  158. package/packages/model/order.js +37 -0
  159. package/packages/model/pageQuery.js +52 -0
  160. package/packages/model/query.js +161 -0
  161. package/packages/model/rel.js +5 -0
  162. package/packages/style.scss +5 -0
  163. package/packages/util/cache.js +92 -0
  164. package/packages/util/dialog.js +133 -0
  165. package/packages/util/escape.js +34 -0
  166. package/packages/util/http.js +18 -0
  167. package/packages/util/pick.js +92 -0
  168. package/packages/util/util.js +892 -0
@@ -0,0 +1,60 @@
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>
@@ -0,0 +1,89 @@
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
+ }
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,54 @@
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>
@@ -0,0 +1,66 @@
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
+ }
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,75 @@
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>
@@ -0,0 +1,67 @@
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
+ collapseTags: true, // 默认合并
14
+ placeholder: '请选择..'
15
+ },
16
+ condMapFn: (cond) => {
17
+ if (isArray(cond.val) && cond.val.length > 0) {
18
+ return [new Cond(cond.col, Opt.IN, cond.val)]
19
+ }
20
+ if (isSampleType(cond.val)) {
21
+ return [new Cond(cond.col, Opt.EQ, cond.val)]
22
+ }
23
+ return []
24
+ }
25
+ }
26
+ const defaultEditConfig = {
27
+ component: 'fast-select',
28
+ val: null,
29
+ props: {
30
+ clearable: true,
31
+ class: 'fc-table-inline-edit-component',
32
+ editable: true,
33
+ rules: []
34
+ }
35
+ }
36
+ export default {
37
+ query: (config, type) => {
38
+ const {props: {defaultVal, ...validProps} = {}} = config
39
+ let val = []
40
+ let component = 'fast-select';
41
+
42
+ if (type === 'quick') {
43
+ val = ternary(isUndefined(defaultVal), defaultQueryConfig.val, defaultVal);
44
+ if (validProps.quickFilterCheckbox !== false) {
45
+ component = 'fast-checkbox-group';
46
+ }
47
+ }
48
+ config.val = val;
49
+ config.component = component;
50
+ config.props = validProps;
51
+ return merge(config, defaultQueryConfig, true, false)
52
+ },
53
+ edit: (config, type) => {
54
+ const {label, props = {}} = config;
55
+ const {defaultVal, rules = [], ...validProps} = props
56
+ // 如果含有值不为false的required属性, 则将其转换为rules规则添加到props中
57
+ if (validProps.hasOwnProperty('required') && validProps.required !== false) {
58
+ rules.push({required: true, message: `${label}不能为空`})
59
+ }
60
+ config.val = ternary(isUndefined(defaultVal), defaultEditConfig.val, defaultVal)
61
+ config.props = {
62
+ ...validProps,
63
+ rules: rules
64
+ }
65
+ return merge(config, defaultEditConfig, true, false)
66
+ }
67
+ }
@@ -0,0 +1,7 @@
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
@@ -0,0 +1,101 @@
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>
@@ -0,0 +1,55 @@
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
+ }
@@ -0,0 +1,7 @@
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