@idooel/components 0.0.0 → 0.0.1-beta.1

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 (32) hide show
  1. package/dist/@idooel/components.esm.js +2634 -0
  2. package/dist/@idooel/components.umd.js +1019 -179
  3. package/package.json +44 -41
  4. package/packages/button/index.js +4 -4
  5. package/packages/button/src/index.vue +54 -24
  6. package/packages/composite-components/button-group/index.js +4 -4
  7. package/packages/composite-components/button-group/src/index.vue +50 -46
  8. package/packages/composite-components/search-area/index.js +4 -4
  9. package/packages/composite-components/search-area/src/index.vue +171 -128
  10. package/packages/composite-components/search-area/src/label.vue +35 -35
  11. package/packages/date/index.js +4 -4
  12. package/packages/date/src/index.vue +39 -39
  13. package/packages/index.js +50 -49
  14. package/packages/input/index.js +4 -4
  15. package/packages/input/src/index.vue +23 -23
  16. package/packages/select/index.js +4 -4
  17. package/packages/select/src/index.vue +34 -34
  18. package/packages/table/index.js +4 -4
  19. package/packages/table/src/action.vue +131 -44
  20. package/packages/table/src/index.vue +157 -88
  21. package/packages/theme/index.scss +12 -0
  22. package/packages/theme/variables.scss +34 -0
  23. package/packages/tpl/index.js +4 -4
  24. package/packages/tpl/src/index.vue +50 -39
  25. package/packages/tree/index.js +4 -4
  26. package/packages/tree/src/TreeNode.vue +29 -29
  27. package/packages/tree/src/index.vue +101 -96
  28. package/packages/tree-table-model/index.js +4 -4
  29. package/packages/tree-table-model/src/index.vue +306 -289
  30. package/scripts/rollup.config.js +35 -41
  31. package/scripts/rollup.esm.config.js +12 -0
  32. package/scripts/rollup.umd.config.js +14 -14
package/package.json CHANGED
@@ -1,41 +1,44 @@
1
- {
2
- "name": "@idooel/components",
3
- "version": "0.0.0",
4
- "description": "",
5
- "private": false,
6
- "main": "dist/@idooel/components.umd.js",
7
- "engines": {
8
- "node": ">=14"
9
- },
10
- "author": "Ruster <protagonisths@gmail.com> (https://github.com/Protagonistss)",
11
- "scripts": {
12
- "build": "rollup --config scripts/rollup.umd.config.js"
13
- },
14
- "keywords": [],
15
- "license": "ISC",
16
- "peerDependencies": {
17
- "ant-design-vue": "1.7.8",
18
- "moment": "^2.30.1",
19
- "@idooel/shared": "workspace:^0.0.0"
20
- },
21
- "devDependencies": {
22
- "@babel/core": "7.17.9",
23
- "@idooel/shared": "workspace:^0.0.0",
24
- "@rollup/plugin-node-resolve": "13.2.0",
25
- "@rollup/plugin-strip": "2.1.0",
26
- "@vue/compiler-sfc": "3.2.33",
27
- "babel-plugin-component": "1.1.1",
28
- "babel-plugin-external-helpers": "6.22.0",
29
- "postcss": "8.4.12",
30
- "postcss-import": "14.1.0",
31
- "rollup": "2.70.1",
32
- "rollup-plugin-babel": "4.4.0",
33
- "rollup-plugin-postcss": "4.0.2",
34
- "rollup-plugin-terser": "^7.0.2",
35
- "rollup-plugin-vue": "5.1.9",
36
- "vue-template-compiler": "2.7.16"
37
- },
38
- "dependencies": {
39
- "uuid": "^9.0.1"
40
- }
41
- }
1
+ {
2
+ "name": "@idooel/components",
3
+ "version": "0.0.1-beta.1",
4
+ "description": "",
5
+ "private": false,
6
+ "main": "dist/@idooel/components.umd.js",
7
+ "module": "dist/@idooel/components.esm.js",
8
+ "engines": {
9
+ "node": ">=14"
10
+ },
11
+ "author": "Ruster <protagonisths@gmail.com> (https://github.com/Protagonistss)",
12
+ "scripts": {
13
+ "build:umd": "rollup --config scripts/rollup.umd.config.js",
14
+ "build:esm": "rollup --config scripts/rollup.esm.config.js"
15
+ },
16
+ "keywords": [],
17
+ "license": "ISC",
18
+ "peerDependencies": {
19
+ "@idooel/shared": "workspace:^0.0.1",
20
+ "ant-design-vue": "1.7.8",
21
+ "moment": "^2.30.1"
22
+ },
23
+ "devDependencies": {
24
+ "@babel/core": "7.17.9",
25
+ "@idooel/expression": "workspace:^0.0.0",
26
+ "@idooel/shared": "workspace:^0.0.1",
27
+ "@rollup/plugin-node-resolve": "13.2.0",
28
+ "@rollup/plugin-strip": "2.1.0",
29
+ "@vue/compiler-sfc": "3.2.33",
30
+ "babel-plugin-component": "1.1.1",
31
+ "babel-plugin-external-helpers": "6.22.0",
32
+ "postcss": "8.4.12",
33
+ "postcss-import": "14.1.0",
34
+ "rollup": "2.70.1",
35
+ "rollup-plugin-babel": "4.4.0",
36
+ "rollup-plugin-postcss": "4.0.2",
37
+ "rollup-plugin-terser": "^7.0.2",
38
+ "rollup-plugin-vue": "5.1.9",
39
+ "vue-template-compiler": "2.7.16"
40
+ },
41
+ "dependencies": {
42
+ "uuid": "^9.0.1"
43
+ }
44
+ }
@@ -1,5 +1,5 @@
1
- import EleButton from './src/index.vue'
2
-
3
- EleButton.install = Vue => Vue.component(EleButton.name, EleButton)
4
-
1
+ import EleButton from './src/index.vue'
2
+
3
+ EleButton.install = Vue => Vue.component(EleButton.name, EleButton)
4
+
5
5
  export default EleButton
@@ -1,25 +1,55 @@
1
- <template>
2
- <a-button :type="type" :icon="icon" @click="handleClick">
3
- <slot></slot>
4
- </a-button>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: 'ele-button',
10
- props: {
11
- type: {
12
- type: String,
13
- default: 'default'
14
- },
15
- icon: {
16
- type: String
17
- }
18
- },
19
- methods: {
20
- handleClick () {
21
- this.$emit('click')
22
- }
23
- }
24
- }
1
+ <template>
2
+ <a-dropdown v-if="mode == 'dropdown'">
3
+ <a-menu slot="overlay" @click="handleMenuClick">
4
+ <a-menu-item :key="opt.value" v-for="opt in dataSource">
5
+ {{ opt.label }}
6
+ </a-menu-item>
7
+ </a-menu>
8
+ <a-button :type="type">
9
+ <slot></slot>
10
+ <a-icon :type="icon" />
11
+ </a-button>
12
+ </a-dropdown>
13
+ <a-button :type="type" :icon="icon" @click="handleClick" v-else>
14
+ <slot></slot>
15
+ </a-button>
16
+ </template>
17
+
18
+ <script>
19
+ export default {
20
+ name: 'ele-button',
21
+ props: {
22
+ record: {
23
+ type: Object
24
+ },
25
+ eventName: {
26
+ type: String
27
+ },
28
+ mode: {
29
+ type: String
30
+ },
31
+ dataSource: {
32
+ type: Array,
33
+ default: () => []
34
+ },
35
+ type: {
36
+ type: String,
37
+ default: 'default'
38
+ },
39
+ icon: {
40
+ type: String
41
+ }
42
+ },
43
+ methods: {
44
+ handleMenuClick (props) {
45
+ const { key } = props
46
+ const currentClickTarget = this.dataSource.find(item => item.value === key)
47
+ const { eventName } = currentClickTarget
48
+ eventName && this.$emit(eventName, { ...currentClickTarget })
49
+ },
50
+ handleClick () {
51
+ this.$emit(this.eventName || 'click', { ...this.record })
52
+ }
53
+ }
54
+ }
25
55
  </script>
@@ -1,5 +1,5 @@
1
- import EleButtonGroup from './src/index.vue'
2
-
3
- EleButtonGroup.install = Vue => Vue.component(EleButtonGroup.name, EleButtonGroup)
4
-
1
+ import EleButtonGroup from './src/index.vue'
2
+
3
+ EleButtonGroup.install = Vue => Vue.component(EleButtonGroup.name, EleButtonGroup)
4
+
5
5
  export default EleButtonGroup
@@ -1,47 +1,51 @@
1
- <template>
2
- <div class="button-group__wrapper">
3
- <ele-button
4
- v-for="(item, idx) in dataSource"
5
- :type="item.type"
6
- :icon="item.icon"
7
- @click="handleClick(item)"
8
- :key="idx">
9
- {{ item.label }}
10
- </ele-button>
11
- </div>
12
- </template>
13
-
14
- <script>
15
- import EleButton from '../../../button/src/index.vue'
16
- export default {
17
- name: 'ele-button-group',
18
- components: {
19
- EleButton
20
- },
21
- props: {
22
- dataSource: {
23
- type: Array,
24
- default: () => []
25
- }
26
- },
27
- methods: {
28
- handleClick (props) {
29
- this.$emit('click', props)
30
- }
31
- }
32
- }
33
- </script>
34
-
35
- <style lang="scss" scoped>
36
- .button-group__wrapper {
37
- display: flex;
38
- padding-left: 16px;
39
- padding-right: 16px;
40
- .ant-btn {
41
- margin-left: 8px;
42
- &:first-child {
43
- margin-left: 0;
44
- }
45
- }
46
- }
1
+ <template>
2
+ <div class="button-group__wrapper">
3
+ <ele-button
4
+ v-for="(item, idx) in dataSource"
5
+ :type="item.type"
6
+ :icon="item.icon"
7
+ :mode="item.mode"
8
+ :data-source="item.optionList"
9
+ :event-name="item.eventName"
10
+ :record="item"
11
+ v-on="$listeners"
12
+ :key="idx">
13
+ {{ item.label }}
14
+ </ele-button>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ import EleButton from '../../../button/src/index.vue'
20
+ export default {
21
+ name: 'ele-button-group',
22
+ components: {
23
+ EleButton
24
+ },
25
+ props: {
26
+ dataSource: {
27
+ type: Array,
28
+ default: () => []
29
+ }
30
+ },
31
+ methods: {
32
+ handleClick (props) {
33
+ this.$emit('click', props)
34
+ }
35
+ }
36
+ }
37
+ </script>
38
+
39
+ <style lang="scss" scoped>
40
+ .button-group__wrapper {
41
+ display: flex;
42
+ padding-left: 16px;
43
+ padding-right: 16px;
44
+ .ant-btn {
45
+ margin-left: 8px;
46
+ &:first-child {
47
+ margin-left: 0;
48
+ }
49
+ }
50
+ }
47
51
  </style>
@@ -1,5 +1,5 @@
1
- import EleSearchArea from './src/index.vue'
2
-
3
- EleSearchArea.install = Vue => Vue.component(EleSearchArea.name, EleSearchArea)
4
-
1
+ import EleSearchArea from './src/index.vue'
2
+
3
+ EleSearchArea.install = Vue => Vue.component(EleSearchArea.name, EleSearchArea)
4
+
5
5
  export default EleSearchArea
@@ -1,129 +1,172 @@
1
- <template>
2
- <div class="search-area__wrapper">
3
- <a-row :gutter="gutter">
4
- <a-col :span="item.span || span" v-for="(item, idx) in innerDataSource" :key="idx">
5
- <div v-if="item.type == '_action'" class="search-area__item search-area--action">
6
- <ele-button icon="search" type="primary" @click="handleClickSearch">查询</ele-button>
7
- <ele-button style="margin-left:8px;" icon="reload" @click="handleClickReset">重置</ele-button>
8
- </div>
9
- <div v-else class="search-area__item">
10
- <template v-if="item.type == 'Input'">
11
- <Label :label="item.label"></Label>
12
- <ele-input v-model="item._value"></ele-input>
13
- </template>
14
- <template v-else-if="item.type == 'Select'">
15
- <Label :label="item.label"></Label>
16
- <ele-select v-model="item._value" :data-source="item.optionList"></ele-select>
17
- </template>
18
- <template v-else-if="item.type == 'DatePicker'">
19
- <Label :label="item.label"></Label>
20
- <ele-date v-model="item._value" :format="item.format"></ele-date>
21
- </template>
22
- </div>
23
- </a-col>
24
- </a-row>
25
- </div>
26
- </template>
27
-
28
- <script>
29
- import EleInput from '../../../input/src/index.vue'
30
- import EleSelect from '../../../select/src/index.vue'
31
- import ELeButton from '../../../button/src/index.vue'
32
- import EleDate from '../../../date/src/index.vue'
33
- import Label from './label.vue'
34
- import moment from 'moment'
35
- export default {
36
- name: 'ele-search-area',
37
- components: {
38
- EleInput,
39
- EleSelect,
40
- ELeButton,
41
- Label,
42
- EleDate
43
- },
44
- props: {
45
- gutter: {
46
- type: [Number, Array, Object],
47
- default: () => ([
48
- 16, 8
49
- ])
50
- },
51
- span: {
52
- type: Number,
53
- default: 8
54
- },
55
- dataSource: {
56
- type: Array,
57
- required: true
58
- }
59
- },
60
- computed: {
61
- actionColOffset () {
62
- return ((24 / this.span) - 1) * this.span
63
- },
64
- innerDataSource () {
65
- return [...this.dataSource, { type: '_action' }]
66
- }
67
- },
68
- methods: {
69
- handleClickSearch () {
70
- const querys = this.extractValues()
71
- this.$emit('search', querys)
72
- },
73
- extractValues () {
74
- let ret = {}
75
- this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
76
- switch (item.type) {
77
- case 'DatePicker':
78
- ret[item.name] = moment(item._value).isValid() ? moment(item._value).format(item.format) : null
79
- break
80
- default:
81
- ret[item.name] = item._value
82
- break
83
- }
84
- })
85
- return ret
86
- },
87
- handleClickReset () {
88
- this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
89
- switch (item.type) {
90
- case 'Select':
91
- this.$set(item, '_value', null)
92
- break
93
- case 'DatePicker':
94
- this.$set(item, '_value', null)
95
- break
96
- default:
97
- this.$set(item, '_value', null)
98
- break
99
- }
100
- })
101
- //TODO defaultValue
102
- const querys = this.extractValues()
103
- this.$emit('search', querys)
104
- },
105
- onChangeSelect (value, props) {
106
- this.$set(props, '_value', value)
107
- }
108
- }
109
- }
110
- </script>
111
-
112
- <style lang="scss" scoped>
113
- .search-area__wrapper {
114
- padding-top: 16px;
115
- padding-left: 16px;
116
- padding-right: 16px;
117
- ::v-deep .ant-col {
118
- &:last-child {
119
- float: right;
120
- }
121
- }
122
- .search-area__item {
123
- height: 32px;
124
- display: flex;
125
- flex-direction: row;
126
- align-items: center;
127
- }
128
- }
1
+ <template>
2
+ <div class="search-area__wrapper">
3
+ <a-row :gutter="gutter">
4
+ <a-col :span="item.span || span" v-for="(item, idx) in innerDataSource" :key="idx">
5
+ <div v-if="item.type == '_action'" class="search-area__item search-area--action">
6
+ <ele-button icon="search" type="primary" @click="handleClickSearch">查询</ele-button>
7
+ <ele-button style="margin-left:8px;" icon="reload" @click="handleClickReset">重置</ele-button>
8
+ <div class="expand-collapse" @click="handleClickExpandCollapse">
9
+ <span class="expand-collapse__text">{{ isExpand ? '收起' : '展开' }}</span>
10
+ <span class="expand-collapse__icon">
11
+ <a-icon v-if="isExpand" type="up" />
12
+ <a-icon v-else type="down" />
13
+ </span>
14
+ </div>
15
+ </div>
16
+ <div v-else class="search-area__item">
17
+ <template v-if="item.type == 'Input'">
18
+ <Label :label="item.label"></Label>
19
+ <ele-input v-model="item._value"></ele-input>
20
+ </template>
21
+ <template v-else-if="item.type == 'Select'">
22
+ <Label :label="item.label"></Label>
23
+ <ele-select v-model="item._value" :data-source="item.optionList"></ele-select>
24
+ </template>
25
+ <template v-else-if="item.type == 'DatePicker'">
26
+ <Label :label="item.label"></Label>
27
+ <ele-date v-model="item._value" :format="item.format"></ele-date>
28
+ </template>
29
+ </div>
30
+ </a-col>
31
+ </a-row>
32
+ </div>
33
+ </template>
34
+
35
+ <script>
36
+ import EleInput from '../../../input/src/index.vue'
37
+ import EleSelect from '../../../select/src/index.vue'
38
+ import ELeButton from '../../../button/src/index.vue'
39
+ import EleDate from '../../../date/src/index.vue'
40
+ import Label from './label.vue'
41
+ import moment from 'moment'
42
+ export default {
43
+ name: 'ele-search-area',
44
+ components: {
45
+ EleInput,
46
+ EleSelect,
47
+ ELeButton,
48
+ Label,
49
+ EleDate
50
+ },
51
+ props: {
52
+ gutter: {
53
+ type: [Number, Array, Object],
54
+ default: () => ([
55
+ 16, 8
56
+ ])
57
+ },
58
+ span: {
59
+ type: Number,
60
+ default: 8
61
+ },
62
+ dataSource: {
63
+ type: Array,
64
+ required: true
65
+ }
66
+ },
67
+ data() {
68
+ return {
69
+ isExpand: false,
70
+ collapseDataSource: []
71
+ }
72
+ },
73
+ computed: {
74
+ actionColOffset () {
75
+ return ((24 / this.span) - 1) * this.span
76
+ },
77
+ innerDataSource () {
78
+ return this.isExpand ? [ ...this.dataSource, { type: '_action' }] : [ ...this.collapseDataSource, { type: '_action' }]
79
+ }
80
+ },
81
+ created() {
82
+ this.collapseDataSource = this.dataSource.slice(0, (24 / this.span - 1))
83
+ },
84
+ methods: {
85
+ handleClickExpandCollapse () {
86
+ if (!this.isExpand) {
87
+ this.collapseDataSource = this.dataSource.slice(0, (24 / this.span - 1))
88
+ }
89
+ this.isExpand = !this.isExpand
90
+ },
91
+ handleClickSearch () {
92
+ const querys = this.extractValues()
93
+ this.$emit('search', querys)
94
+ },
95
+ extractValues () {
96
+ let ret = {}
97
+ this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
98
+ switch (item.type) {
99
+ case 'DatePicker':
100
+ ret[item.name] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format)
101
+ break
102
+ default:
103
+ ret[item.name] = item._value
104
+ break
105
+ }
106
+ })
107
+ return ret
108
+ },
109
+ handleClickReset () {
110
+ this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
111
+ switch (item.type) {
112
+ case 'Select':
113
+ this.$set(item, '_value', null)
114
+ break
115
+ case 'DatePicker':
116
+ this.$set(item, '_value', undefined)
117
+ break
118
+ default:
119
+ this.$set(item, '_value', null)
120
+ break
121
+ }
122
+ })
123
+ //TODO defaultValue
124
+ const querys = this.extractValues()
125
+ this.$emit('search', querys)
126
+ },
127
+ onChangeSelect (value, props) {
128
+ this.$set(props, '_value', value)
129
+ }
130
+ }
131
+ }
132
+ </script>
133
+
134
+ <style lang="scss" scoped>
135
+ .search-area__wrapper {
136
+ padding-top: 16px;
137
+ padding-left: 16px;
138
+ padding-right: 16px;
139
+ ::v-deep .ant-col {
140
+ &:last-child {
141
+ float: right;
142
+ }
143
+ }
144
+ .search-area__item {
145
+ height: 32px;
146
+ display: flex;
147
+ flex-direction: row;
148
+ align-items: center;
149
+ &.search-area--action {
150
+ justify-content: end;
151
+ }
152
+ .expand-collapse {
153
+ margin-left: 8px;
154
+ height: 32px;
155
+ padding: 4px 16px;
156
+ color: var(--idooel-primary-color);
157
+ display: flex;
158
+ flex-direction: row;
159
+ align-items: center;
160
+ justify-content: center;
161
+ cursor: pointer;
162
+ .expand-collapse__text {
163
+ font-size: 14px;
164
+ }
165
+ .expand-collapse__icon {
166
+ font-size: 16px;
167
+ margin-left: 8px;
168
+ }
169
+ }
170
+ }
171
+ }
129
172
  </style>