@idooel/components 0.0.0 → 0.0.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.
package/package.json CHANGED
@@ -1,25 +1,28 @@
1
1
  {
2
2
  "name": "@idooel/components",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "",
5
5
  "private": false,
6
6
  "main": "dist/@idooel/components.umd.js",
7
+ "module": "dist/@idooel/components.esm.js",
7
8
  "engines": {
8
9
  "node": ">=14"
9
10
  },
10
11
  "author": "Ruster <protagonisths@gmail.com> (https://github.com/Protagonistss)",
11
12
  "scripts": {
12
- "build": "rollup --config scripts/rollup.umd.config.js"
13
+ "build:umd": "rollup --config scripts/rollup.umd.config.js",
14
+ "build:esm": "rollup --config scripts/rollup.esm.config.js"
13
15
  },
14
16
  "keywords": [],
15
17
  "license": "ISC",
16
18
  "peerDependencies": {
19
+ "@idooel/shared": "workspace:^0.0.0",
17
20
  "ant-design-vue": "1.7.8",
18
- "moment": "^2.30.1",
19
- "@idooel/shared": "workspace:^0.0.0"
21
+ "moment": "^2.30.1"
20
22
  },
21
23
  "devDependencies": {
22
24
  "@babel/core": "7.17.9",
25
+ "@idooel/expression": "workspace:^0.0.0",
23
26
  "@idooel/shared": "workspace:^0.0.0",
24
27
  "@rollup/plugin-node-resolve": "13.2.0",
25
28
  "@rollup/plugin-strip": "2.1.0",
@@ -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,25 @@
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-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
+ }
25
25
  </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,47 @@
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
+ @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
+ }
47
47
  </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,129 @@
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>
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] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format)
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', undefined)
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
+ }
129
129
  </style>
@@ -1,36 +1,36 @@
1
- <template>
2
- <div class="g-search__label">
3
- <span class="label__title">{{ label }}</span>
4
- <span class="label__suffix">:</span>
5
- </div>
6
- </template>
7
-
8
- <script>
9
- export default {
10
- props: {
11
- label: {
12
- type: String
13
- }
14
- }
15
- }
16
- </script>
17
-
18
- <style lang="scss" scoped>
19
- .g-search__label {
20
- /* width: 69px; */
21
- flex-basis: 69px;
22
- height: 32px;
23
- display: flex;
24
- flex-direction: row;
25
- align-items: center;
26
- justify-content: space-between;
27
- .label__title, .label__suffix {
28
- font-size: 14px;
29
- color: rgba(0, 0, 0, 0.88);
30
- white-space: nowrap;
31
- }
32
- .label__suffix {
33
- margin-left: 4px;
34
- }
35
- }
1
+ <template>
2
+ <div class="g-search__label">
3
+ <span class="label__title">{{ label }}</span>
4
+ <span class="label__suffix">:</span>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ export default {
10
+ props: {
11
+ label: {
12
+ type: String
13
+ }
14
+ }
15
+ }
16
+ </script>
17
+
18
+ <style lang="scss" scoped>
19
+ .g-search__label {
20
+ /* width: 69px; */
21
+ flex-basis: 69px;
22
+ height: 32px;
23
+ display: flex;
24
+ flex-direction: row;
25
+ align-items: center;
26
+ justify-content: space-between;
27
+ .label__title, .label__suffix {
28
+ font-size: 14px;
29
+ color: rgba(0, 0, 0, 0.88);
30
+ white-space: nowrap;
31
+ }
32
+ .label__suffix {
33
+ margin-left: 4px;
34
+ }
35
+ }
36
36
  </style>
@@ -1,5 +1,5 @@
1
- import EleDate from './src/index.vue'
2
-
3
- EleDate.install = Vue => Vue.component(EleDate.name, EleDate)
4
-
1
+ import EleDate from './src/index.vue'
2
+
3
+ EleDate.install = Vue => Vue.component(EleDate.name, EleDate)
4
+
5
5
  export default EleDate
@@ -1,40 +1,40 @@
1
- <template>
2
- <a-date-picker
3
- style="width: 100%;"
4
- mode="year"
5
- :open="open"
6
- :value="value"
7
- @focus="onFocus"
8
- @panelChange="onPanelChange"
9
- :format="format">
10
- </a-date-picker>
11
- </template>
12
-
13
- <script>
14
- export default {
15
- name: 'ele-date',
16
- props: {
17
- value: {
18
- type: Object
19
- },
20
- format: {
21
- type: String,
22
- default: 'YYYY/MM/DD'
23
- }
24
- },
25
- data () {
26
- return {
27
- open: false
28
- }
29
- },
30
- methods: {
31
- onFocus () {
32
- this.open = true
33
- },
34
- onPanelChange (value, mode) {
35
- this.$emit('input', value)
36
- this.open = false
37
- }
38
- }
39
- }
1
+ <template>
2
+ <a-date-picker
3
+ style="width: 100%;"
4
+ mode="year"
5
+ :open="open"
6
+ :value="value"
7
+ @focus="onFocus"
8
+ @panelChange="onPanelChange"
9
+ :format="format">
10
+ </a-date-picker>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: 'ele-date',
16
+ props: {
17
+ value: {
18
+ type: Object
19
+ },
20
+ format: {
21
+ type: String,
22
+ default: 'YYYY/MM/DD'
23
+ }
24
+ },
25
+ data () {
26
+ return {
27
+ open: false
28
+ }
29
+ },
30
+ methods: {
31
+ onFocus () {
32
+ this.open = true
33
+ },
34
+ onPanelChange (value, mode) {
35
+ this.$emit('input', value)
36
+ this.open = false
37
+ }
38
+ }
39
+ }
40
40
  </script>