@ditojs/admin 2.0.4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dito-admin.es.js +2065 -1969
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +32 -31
- package/src/DitoAdmin.js +66 -31
- package/src/DitoComponent.js +4 -1
- package/src/DitoContext.js +13 -5
- package/src/{TypeComponent.js → DitoTypeComponent.js} +8 -5
- package/src/components/DitoAccount.vue +20 -19
- package/src/components/DitoButtons.vue +14 -12
- package/src/components/DitoClipboard.vue +16 -8
- package/src/components/DitoContainer.vue +56 -43
- package/src/components/DitoCreateButton.vue +20 -15
- package/src/components/DitoDialog.vue +78 -53
- package/src/components/DitoEditButtons.vue +16 -14
- package/src/components/DitoElement.vue +2 -3
- package/src/components/DitoErrors.vue +18 -13
- package/src/components/DitoForm.vue +41 -24
- package/src/components/DitoFormNested.vue +12 -10
- package/src/components/DitoHeader.vue +103 -69
- package/src/components/DitoLabel.vue +108 -81
- package/src/components/DitoMenu.vue +52 -36
- package/src/components/DitoPagination.vue +9 -7
- package/src/components/DitoPane.vue +53 -45
- package/src/components/DitoPanel.vue +62 -42
- package/src/components/DitoPanels.vue +11 -10
- package/src/components/DitoRoot.vue +57 -46
- package/src/components/DitoSchema.vue +179 -131
- package/src/components/DitoSchemaInlined.vue +39 -28
- package/src/components/DitoScopes.vue +41 -31
- package/src/components/DitoSpinner.vue +31 -40
- package/src/components/DitoTableCell.vue +9 -9
- package/src/components/DitoTableHead.vue +52 -37
- package/src/components/DitoTabs.vue +39 -29
- package/src/components/DitoTreeItem.vue +140 -86
- package/src/components/DitoVNode.vue +1 -1
- package/src/components/DitoView.vue +13 -11
- package/src/mixins/DataMixin.js +11 -9
- package/src/mixins/DitoMixin.js +47 -25
- package/src/mixins/EmitterMixin.js +2 -1
- package/src/mixins/ItemMixin.js +15 -10
- package/src/mixins/LoadingMixin.js +2 -1
- package/src/mixins/NumberMixin.js +15 -10
- package/src/mixins/OptionsMixin.js +24 -12
- package/src/mixins/ResourceMixin.js +42 -34
- package/src/mixins/RouteMixin.js +8 -8
- package/src/mixins/SortableMixin.js +1 -1
- package/src/mixins/SourceMixin.js +68 -34
- package/src/mixins/TypeMixin.js +5 -4
- package/src/mixins/ValidationMixin.js +3 -0
- package/src/styles/_base.scss +17 -0
- package/src/styles/_button.scss +212 -0
- package/src/styles/_imports.scss +2 -0
- package/src/styles/_layout.scss +22 -0
- package/src/styles/_notifications.scss +54 -0
- package/src/styles/_pulldown.scss +39 -0
- package/src/styles/_scroll.scss +15 -0
- package/src/styles/_settings.scss +68 -0
- package/src/styles/_sortable.scss +13 -0
- package/src/styles/_table.scss +224 -0
- package/src/styles/style.scss +9 -0
- package/src/types/DitoTypeButton.vue +72 -0
- package/src/types/{TypeCheckbox.vue → DitoTypeCheckbox.vue} +12 -11
- package/src/types/{TypeCheckboxes.vue → DitoTypeCheckboxes.vue} +21 -15
- package/src/types/{TypeCode.vue → DitoTypeCode.vue} +46 -34
- package/src/types/{TypeColor.vue → DitoTypeColor.vue} +71 -52
- package/src/types/{TypeComponent.vue → DitoTypeComponent.vue} +2 -2
- package/src/types/DitoTypeComputed.vue +54 -0
- package/src/types/DitoTypeDate.vue +64 -0
- package/src/types/DitoTypeLabel.vue +23 -0
- package/src/types/{TypeList.vue → DitoTypeList.vue} +83 -61
- package/src/types/{TypeMarkup.vue → DitoTypeMarkup.vue} +172 -122
- package/src/types/DitoTypeMultiselect.vue +434 -0
- package/src/types/DitoTypeNumber.vue +46 -0
- package/src/types/{TypeObject.vue → DitoTypeObject.vue} +41 -26
- package/src/types/{TypePanel.vue → DitoTypePanel.vue} +2 -2
- package/src/types/{TypeProgress.vue → DitoTypeProgress.vue} +4 -6
- package/src/types/{TypeRadio.vue → DitoTypeRadio.vue} +17 -13
- package/src/types/{TypeSection.vue → DitoTypeSection.vue} +17 -17
- package/src/types/{TypeSelect.vue → DitoTypeSelect.vue} +39 -35
- package/src/types/{TypeSlider.vue → DitoTypeSlider.vue} +29 -23
- package/src/types/{TypeSwitch.vue → DitoTypeSwitch.vue} +15 -13
- package/src/types/DitoTypeText.vue +77 -0
- package/src/types/{TypeTextarea.vue → DitoTypeTextarea.vue} +17 -14
- package/src/types/DitoTypeTreeList.vue +191 -0
- package/src/types/{TypeUpload.vue → DitoTypeUpload.vue} +92 -65
- package/src/types/index.js +26 -26
- package/src/utils/SchemaGraph.js +21 -13
- package/src/utils/accessor.js +17 -9
- package/src/utils/data.js +4 -1
- package/src/utils/filter.js +8 -10
- package/src/utils/options.js +3 -3
- package/src/utils/resource.js +12 -10
- package/src/utils/schema.js +190 -125
- package/src/utils/type.js +31 -20
- package/src/validations/_decimals.js +1 -2
- package/types/index.d.ts +27 -23
- package/src/styles/_base.sass +0 -15
- package/src/styles/_button.sass +0 -127
- package/src/styles/_imports.sass +0 -2
- package/src/styles/_layout.sass +0 -13
- package/src/styles/_notifications.sass +0 -33
- package/src/styles/_pulldown.sass +0 -26
- package/src/styles/_scroll.sass +0 -13
- package/src/styles/_settings.sass +0 -55
- package/src/styles/_sortable.sass +0 -9
- package/src/styles/_table.sass +0 -153
- package/src/styles/style.sass +0 -10
- package/src/types/TypeButton.vue +0 -73
- package/src/types/TypeComputed.vue +0 -53
- package/src/types/TypeDate.vue +0 -64
- package/src/types/TypeLabel.vue +0 -19
- package/src/types/TypeMultiselect.vue +0 -376
- package/src/types/TypeNumber.vue +0 -44
- package/src/types/TypeText.vue +0 -67
- package/src/types/TypeTreeList.vue +0 -164
package/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
TimeFormat
|
|
9
9
|
} from '@ditojs/utils'
|
|
10
10
|
import { RequireAtLeastOne, SetOptional } from 'type-fest'
|
|
11
|
-
import
|
|
11
|
+
import { Component as VueComponent } from 'vue'
|
|
12
12
|
|
|
13
13
|
declare global {
|
|
14
14
|
const dito: DitoGlobal
|
|
@@ -453,7 +453,7 @@ export type ComponentSchema<$Item = any> = BaseSchema<$Item> & {
|
|
|
453
453
|
* Use a Vue component to render the component. The component is specified
|
|
454
454
|
* like this: import(...).
|
|
455
455
|
*/
|
|
456
|
-
component: Resolvable<
|
|
456
|
+
component: Resolvable<VueComponent>
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
export type InputSchema<$Item = any> = BaseSchema<$Item> & {
|
|
@@ -850,7 +850,7 @@ export type ColumnSchema<$Item = any> = {
|
|
|
850
850
|
* Use a Vue component to render the cell. The component is specified
|
|
851
851
|
* like this: import(...).
|
|
852
852
|
*/
|
|
853
|
-
component?: Resolvable<
|
|
853
|
+
component?: Resolvable<VueComponent>
|
|
854
854
|
/**
|
|
855
855
|
* Whether the column should be sortable.
|
|
856
856
|
*/
|
|
@@ -1010,13 +1010,13 @@ export type DitoContext<$Item = any> = {
|
|
|
1010
1010
|
itemLabel: string | null
|
|
1011
1011
|
formLabel: string | null
|
|
1012
1012
|
component: any
|
|
1013
|
-
schemaComponent:
|
|
1013
|
+
schemaComponent: VueComponent | null
|
|
1014
1014
|
formComponent: any
|
|
1015
1015
|
viewComponent: any
|
|
1016
1016
|
dialogComponent: any
|
|
1017
|
-
panelComponent:
|
|
1018
|
-
resourceComponent:
|
|
1019
|
-
sourceComponent:
|
|
1017
|
+
panelComponent: VueComponent | null
|
|
1018
|
+
resourceComponent: VueComponent | null
|
|
1019
|
+
sourceComponent: VueComponent | null
|
|
1020
1020
|
option: any
|
|
1021
1021
|
options: any
|
|
1022
1022
|
query: string
|
|
@@ -1058,17 +1058,19 @@ export type DitoContext<$Item = any> = {
|
|
|
1058
1058
|
}): void
|
|
1059
1059
|
}
|
|
1060
1060
|
|
|
1061
|
-
export type View<$Item = any> =
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1061
|
+
export type View<$Item = any> =
|
|
1062
|
+
| {
|
|
1063
|
+
type: 'view'
|
|
1064
|
+
resource?: Form['resource']
|
|
1065
|
+
clipboard?: Form['clipboard']
|
|
1066
|
+
component?: Component<$Item>
|
|
1067
|
+
}
|
|
1068
|
+
| {
|
|
1069
|
+
type: 'view'
|
|
1070
|
+
resource?: Form['resource']
|
|
1071
|
+
clipboard?: Form['clipboard']
|
|
1072
|
+
components?: Components<$Item>
|
|
1073
|
+
}
|
|
1072
1074
|
|
|
1073
1075
|
export type Component<$Item = any> =
|
|
1074
1076
|
| InputSchema<$Item>
|
|
@@ -1093,9 +1095,11 @@ export type Component<$Item = any> =
|
|
|
1093
1095
|
| SectionSchema<$Item>
|
|
1094
1096
|
| HiddenSchema<$Item>
|
|
1095
1097
|
|
|
1096
|
-
export type Components<$Item = any> =
|
|
1097
|
-
|
|
1098
|
-
|
|
1098
|
+
export type Components<$Item = any> =
|
|
1099
|
+
| Component<$Item>[]
|
|
1100
|
+
| {
|
|
1101
|
+
[$name: string]: Component<$Item>
|
|
1102
|
+
}
|
|
1099
1103
|
|
|
1100
1104
|
export type Buttons<$Item> = Record<
|
|
1101
1105
|
string,
|
|
@@ -1125,7 +1129,7 @@ export type Form<$Item = any> = {
|
|
|
1125
1129
|
string,
|
|
1126
1130
|
Omit<Form<$Item>, 'tabs' | 'type'> & {
|
|
1127
1131
|
defaultTab?: OrItemAccessor<$Item, {}, boolean>
|
|
1128
|
-
|
|
1132
|
+
}
|
|
1129
1133
|
>
|
|
1130
1134
|
// TODO: document components
|
|
1131
1135
|
components?: Components<$Item>
|
|
@@ -1154,7 +1158,7 @@ export class DitoAdmin<
|
|
|
1154
1158
|
> {
|
|
1155
1159
|
api: ApiConfig
|
|
1156
1160
|
// TODO: finish off Vue types
|
|
1157
|
-
root:
|
|
1161
|
+
root: VueComponent
|
|
1158
1162
|
constructor(
|
|
1159
1163
|
element: Element | string,
|
|
1160
1164
|
options?: {
|
package/src/styles/_base.sass
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
+reset
|
|
2
|
-
|
|
3
|
-
\:root
|
|
4
|
-
--font-size: #{$font-size}
|
|
5
|
-
--line-height: #{$line-height}
|
|
6
|
-
--color-text: #{$color-text}
|
|
7
|
-
font-size: var(--font-size)
|
|
8
|
-
line-height: var(--line-height)
|
|
9
|
-
color: var(--color-text)
|
|
10
|
-
background: $content-color-background
|
|
11
|
-
font-family: $font-family-sans
|
|
12
|
-
-moz-osx-font-smoothing: grayscale
|
|
13
|
-
-webkit-font-smoothing: antialiased
|
|
14
|
-
overflow-x: hidden
|
|
15
|
-
max-width: 100%
|
package/src/styles/_button.sass
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
.dito-button
|
|
2
|
-
// .dito-button with order-arrows:
|
|
3
|
-
.dito-order-arrows
|
|
4
|
-
display: inline-block
|
|
5
|
-
width: round($button-order-arrow-size * $math-sqrt2)
|
|
6
|
-
padding-left: $form-spacing
|
|
7
|
-
$arrow-offset: calc($button-order-arrow-size / 2 + $border-width)
|
|
8
|
-
&::before
|
|
9
|
-
+arrow($button-order-arrow-size, 'up')
|
|
10
|
-
bottom: $arrow-offset
|
|
11
|
-
&::after
|
|
12
|
-
+arrow($button-order-arrow-size, 'down')
|
|
13
|
-
top: $arrow-offset
|
|
14
|
-
&.dito-order-asc .dito-order-arrows
|
|
15
|
-
&::before
|
|
16
|
-
bottom: 0
|
|
17
|
-
&::after
|
|
18
|
-
display: none
|
|
19
|
-
&.dito-order-desc .dito-order-arrows
|
|
20
|
-
&::before
|
|
21
|
-
display: none
|
|
22
|
-
&::after
|
|
23
|
-
top: 0
|
|
24
|
-
|
|
25
|
-
.dito-button-create:empty::before
|
|
26
|
-
content: 'Create'
|
|
27
|
-
.dito-button-add:empty::before
|
|
28
|
-
content: 'Add'
|
|
29
|
-
.dito-button-delete:empty::before
|
|
30
|
-
content: 'Delete'
|
|
31
|
-
.dito-button-remove:empty::before
|
|
32
|
-
content: 'Remove'
|
|
33
|
-
.dito-button-edit:empty::before
|
|
34
|
-
content: 'Edit'
|
|
35
|
-
.dito-button-save:empty::before
|
|
36
|
-
content: 'Save'
|
|
37
|
-
.dito-button-apply:empty::before
|
|
38
|
-
content: 'Apply'
|
|
39
|
-
.dito-button-login:empty::before
|
|
40
|
-
content: 'Login'
|
|
41
|
-
.dito-button-ok:empty::before
|
|
42
|
-
content: 'OK'
|
|
43
|
-
.dito-button-cancel:empty::before
|
|
44
|
-
content: 'Cancel'
|
|
45
|
-
.dito-button-close:empty::before
|
|
46
|
-
content: 'Close'
|
|
47
|
-
.dito-button-drag:empty::before
|
|
48
|
-
content: 'Drag'
|
|
49
|
-
.dito-button-copy:empty::before
|
|
50
|
-
content: 'Copy'
|
|
51
|
-
.dito-button-paste:empty::before
|
|
52
|
-
content: 'Paste'
|
|
53
|
-
|
|
54
|
-
.dito-button-drag
|
|
55
|
-
cursor: grab
|
|
56
|
-
&:active
|
|
57
|
-
cursor: grabbing
|
|
58
|
-
|
|
59
|
-
.dito-buttons
|
|
60
|
-
&.dito-buttons-large
|
|
61
|
-
--button-margin: 3px
|
|
62
|
-
font-size: $menu-font-size
|
|
63
|
-
flex-flow: row wrap
|
|
64
|
-
justify-content: center
|
|
65
|
-
.dito-container
|
|
66
|
-
// Do not specify this on .dito-buttons directly as it would break borders
|
|
67
|
-
margin-top: $content-padding
|
|
68
|
-
.dito-button
|
|
69
|
-
border-radius: 2em
|
|
70
|
-
padding: $button-round-padding
|
|
71
|
-
&.dito-buttons-main
|
|
72
|
-
position: sticky
|
|
73
|
-
bottom: 0
|
|
74
|
-
width: 100%
|
|
75
|
-
align-self: flex-end
|
|
76
|
-
z-index: 500
|
|
77
|
-
padding-bottom: $content-padding
|
|
78
|
-
margin-bottom: -$content-padding
|
|
79
|
-
margin-top: 2 * $content-padding
|
|
80
|
-
box-shadow: 0 (-$content-padding) $content-padding (-$content-padding) $color-shadow
|
|
81
|
-
background: $content-color-background
|
|
82
|
-
|
|
83
|
-
&.dito-buttons-round,
|
|
84
|
-
&.dito-buttons-small
|
|
85
|
-
// For now, nothing for these:
|
|
86
|
-
// .dito-button-create:empty::before,
|
|
87
|
-
// .dito-button-add:empty::before
|
|
88
|
-
// Special .dito-button-add-upload without :empty:
|
|
89
|
-
.dito-button-add-upload::before
|
|
90
|
-
@extend %icon-add
|
|
91
|
-
.dito-button-delete:empty::before,
|
|
92
|
-
.dito-button-remove:empty::before
|
|
93
|
-
@extend %icon-remove
|
|
94
|
-
.dito-button-edit:empty::before
|
|
95
|
-
@extend %icon-edit
|
|
96
|
-
.dito-button-drag:empty::before
|
|
97
|
-
@extend %icon-drag
|
|
98
|
-
.dito-button-copy:empty::before
|
|
99
|
-
@extend %icon-copy
|
|
100
|
-
.dito-button-paste:empty::before
|
|
101
|
-
@extend %icon-paste
|
|
102
|
-
|
|
103
|
-
.dito-button-overlay
|
|
104
|
-
position: absolute
|
|
105
|
-
right: $border-width
|
|
106
|
-
top: $border-width
|
|
107
|
-
bottom: $border-width
|
|
108
|
-
border: 0
|
|
109
|
-
border-radius: $border-radius
|
|
110
|
-
cursor: pointer
|
|
111
|
-
&.dito-button-clear
|
|
112
|
-
width: $input-height
|
|
113
|
-
z-index: 1
|
|
114
|
-
background: $color-white
|
|
115
|
-
display: none
|
|
116
|
-
$button-clear: &
|
|
117
|
-
@at-root .dito-component:hover
|
|
118
|
-
// Support two levels of nesting inside .dito-component, used by TypeColor
|
|
119
|
-
& > #{$button-clear},
|
|
120
|
-
& > * > #{$button-clear},
|
|
121
|
-
& > * > * > #{$button-clear}
|
|
122
|
-
display: block
|
|
123
|
-
&::before
|
|
124
|
-
@extend %icon-clear
|
|
125
|
-
color: $color-grey
|
|
126
|
-
&:hover::before
|
|
127
|
-
color: $color-black
|
package/src/styles/_imports.sass
DELETED
package/src/styles/_layout.sass
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
=type($background)
|
|
2
|
-
background: lighten($background, 5)
|
|
3
|
-
color: $color-white
|
|
4
|
-
border-left: 12px solid darken($background, 10)
|
|
5
|
-
|
|
6
|
-
.dito-notifications
|
|
7
|
-
.dito-notification
|
|
8
|
-
padding: 8px
|
|
9
|
-
margin: 12px 12px 0
|
|
10
|
-
font-size: inherit
|
|
11
|
-
color: $color-white
|
|
12
|
-
border-radius: $border-radius
|
|
13
|
-
box-shadow: $shadow-window
|
|
14
|
-
.notification-title
|
|
15
|
-
font-weight: bold
|
|
16
|
-
padding-bottom: 8px
|
|
17
|
-
.notification-content
|
|
18
|
-
p
|
|
19
|
-
margin: 0
|
|
20
|
-
& + p
|
|
21
|
-
margin-top: 8px
|
|
22
|
-
&,
|
|
23
|
-
&.info
|
|
24
|
-
+type($color-active)
|
|
25
|
-
&.success
|
|
26
|
-
+type($color-success)
|
|
27
|
-
&.warning
|
|
28
|
-
+type($color-warning)
|
|
29
|
-
&.error
|
|
30
|
-
+type($color-error)
|
|
31
|
-
|
|
32
|
-
.vue-notification-wrapper
|
|
33
|
-
overflow: visible
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
ul.dito-pulldown
|
|
2
|
-
display: none
|
|
3
|
-
position: absolute
|
|
4
|
-
top: 0
|
|
5
|
-
z-index: 1000
|
|
6
|
-
border-radius: $pulldown-radius
|
|
7
|
-
box-shadow: $shadow-window
|
|
8
|
-
&.dito-open
|
|
9
|
-
display: block
|
|
10
|
-
li
|
|
11
|
-
+user-select(none)
|
|
12
|
-
a
|
|
13
|
-
display: block
|
|
14
|
-
text-align: center
|
|
15
|
-
padding: $pulldown-padding
|
|
16
|
-
line-height: 1
|
|
17
|
-
background: $button-color
|
|
18
|
-
&:hover
|
|
19
|
-
background: $color-active
|
|
20
|
-
color: $color-white
|
|
21
|
-
&:first-child a
|
|
22
|
-
border-top-left-radius: $pulldown-radius
|
|
23
|
-
border-top-right-radius: $pulldown-radius
|
|
24
|
-
&:last-child a
|
|
25
|
-
border-bottom-left-radius: $pulldown-radius
|
|
26
|
-
border-bottom-right-radius: $pulldown-radius
|
package/src/styles/_scroll.sass
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Typography
|
|
2
|
-
$font-family-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif
|
|
3
|
-
$font-family-mono: 'Menlo', 'Consolas', 'Monaco', 'Vera Mono', 'Andale Mono', 'Ubuntu Mono', monospace
|
|
4
|
-
$font-size: 13px
|
|
5
|
-
$font-size-small: 11px
|
|
6
|
-
// Adjust line-height so that it fulfills this equation, which is used
|
|
7
|
-
// to reach equal height for icon-buttons (`height: 2em`), table headers & co.:
|
|
8
|
-
// `(2 * $font-size - 2 * ($border-width + $input-padding-ver)) / $font-size`
|
|
9
|
-
// TODO: Ideally, this would be handled in @ditojs/ui, but it would have to be
|
|
10
|
-
// done in a way independent of `$font-size`. The right approach would probably
|
|
11
|
-
// be to use `$input-height` and vertical centering instead for all inputs that
|
|
12
|
-
// have a height of one line?
|
|
13
|
-
// NOTE: Due to higher precision in dart-sass, this needs to be rounded to 5
|
|
14
|
-
// fractional digits, otherwise CSS creates the wrong resulting line-height with
|
|
15
|
-
// 1 mixsing pixel.
|
|
16
|
-
$line-height: rounded(calc($input-height-factor - 2 * ($border-width + $input-padding-ver) / $font-size), 5)
|
|
17
|
-
|
|
18
|
-
// Button
|
|
19
|
-
$button-order-arrow-size: 4px
|
|
20
|
-
|
|
21
|
-
// Pulldown
|
|
22
|
-
$pulldown-radius: 0.5em
|
|
23
|
-
$pulldown-padding-ver: 0.5em
|
|
24
|
-
$pulldown-padding-hor: 1em
|
|
25
|
-
$pulldown-padding: $pulldown-padding-ver $pulldown-padding-hor
|
|
26
|
-
|
|
27
|
-
// Content
|
|
28
|
-
$content-width: 900px
|
|
29
|
-
$content-sidebar-width: 360px
|
|
30
|
-
$content-padding: 16px
|
|
31
|
-
$content-padding-half: calc($content-padding / 2)
|
|
32
|
-
$content-color-background: $color-lightest
|
|
33
|
-
|
|
34
|
-
// Form
|
|
35
|
-
$form-spacing: $input-padding-hor
|
|
36
|
-
$form-spacing-half: calc($form-spacing / 2)
|
|
37
|
-
|
|
38
|
-
// Menu
|
|
39
|
-
$menu-font-size: 14px
|
|
40
|
-
$menu-line-height: 1
|
|
41
|
-
$menu-z-index: 1000
|
|
42
|
-
$menu-padding-ver: $menu-font-size
|
|
43
|
-
$menu-padding-hor: $content-padding
|
|
44
|
-
$menu-padding: $menu-padding-ver $menu-padding-hor
|
|
45
|
-
$menu-height: $menu-font-size + 2 * $menu-padding-ver
|
|
46
|
-
|
|
47
|
-
// Tabs
|
|
48
|
-
$tab-margin: 6px
|
|
49
|
-
$tab-padding-hor: 12px
|
|
50
|
-
$tab-padding-ver: calc(($menu-padding-ver * 2 - $tab-margin) / 2)
|
|
51
|
-
$tab-radius: 4px // $border-radius
|
|
52
|
-
|
|
53
|
-
// Patterns
|
|
54
|
-
$pattern-transparency-size: ($font-size - $border-width) * $input-height-factor
|
|
55
|
-
$pattern-transparency: repeating-conic-gradient(transparent 0% 25%, #eee 0% 50%) 0% 0% / #{$pattern-transparency-size} #{$pattern-transparency-size}
|
package/src/styles/_table.sass
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
=table-border
|
|
2
|
-
// Note: No border-width set here on purpose!
|
|
3
|
-
border-style: solid
|
|
4
|
-
border-color: $border-color
|
|
5
|
-
|
|
6
|
-
=table-border-left
|
|
7
|
-
border-left-width: $border-width
|
|
8
|
-
|
|
9
|
-
=table-border-right
|
|
10
|
-
border-right-width: $border-width
|
|
11
|
-
|
|
12
|
-
=table-border-top
|
|
13
|
-
border-top-width: $border-width
|
|
14
|
-
|
|
15
|
-
=table-border-bottom
|
|
16
|
-
border-bottom-width: $border-width
|
|
17
|
-
|
|
18
|
-
=table-border-top-left
|
|
19
|
-
+table-border-top
|
|
20
|
-
+table-border-left
|
|
21
|
-
border-top-left-radius: $border-radius
|
|
22
|
-
|
|
23
|
-
=table-border-top-right
|
|
24
|
-
+table-border-top
|
|
25
|
-
+table-border-right
|
|
26
|
-
border-top-right-radius: $border-radius
|
|
27
|
-
|
|
28
|
-
=table-border-bottom-left
|
|
29
|
-
+table-border-bottom
|
|
30
|
-
+table-border-left
|
|
31
|
-
border-bottom-left-radius: $border-radius
|
|
32
|
-
|
|
33
|
-
=table-border-bottom-right
|
|
34
|
-
+table-border-bottom
|
|
35
|
-
+table-border-right
|
|
36
|
-
border-bottom-right-radius: $border-radius
|
|
37
|
-
|
|
38
|
-
table.dito-table
|
|
39
|
-
--separator-width: #{$border-width}
|
|
40
|
-
width: 100%
|
|
41
|
-
height: min-content
|
|
42
|
-
border-radius: $border-radius
|
|
43
|
-
|
|
44
|
-
> tbody,
|
|
45
|
-
> tfoot
|
|
46
|
-
> tr
|
|
47
|
-
vertical-align: baseline
|
|
48
|
-
> td
|
|
49
|
-
padding: $form-spacing 0 $form-spacing $form-spacing
|
|
50
|
-
background: $content-color-background
|
|
51
|
-
&:last-child
|
|
52
|
-
padding-right: $form-spacing
|
|
53
|
-
&.dito-cell-edit-buttons
|
|
54
|
-
width: 1%
|
|
55
|
-
&,
|
|
56
|
-
.dito-button
|
|
57
|
-
// To align better with `vertical-align: baseline` in normal td:
|
|
58
|
-
vertical-align: top
|
|
59
|
-
|
|
60
|
-
&.dito-table-larger-padding
|
|
61
|
-
// Add more spacing to cells in tables except those containing edit buttons,
|
|
62
|
-
// to better align cell texts with edit buttons.
|
|
63
|
-
td:not(.dito-cell-edit-buttons)
|
|
64
|
-
$padding: $form-spacing * 1.5
|
|
65
|
-
padding: $padding 0 $padding $padding
|
|
66
|
-
|
|
67
|
-
// Variants of list styles: separators and alternate colors.
|
|
68
|
-
&.dito-table-separators
|
|
69
|
-
> tbody > tr + tr,
|
|
70
|
-
> tbody:not(:empty) + tfoot > tr
|
|
71
|
-
> td
|
|
72
|
-
border-top: var(--separator-width) solid $border-color
|
|
73
|
-
|
|
74
|
-
&.dito-table-alternate-colors
|
|
75
|
-
> tbody > tr:nth-child(odd),
|
|
76
|
-
&.dito-table-even-count > tfoot > tr
|
|
77
|
-
> td
|
|
78
|
-
background: $color-white
|
|
79
|
-
|
|
80
|
-
&.dito-table-background
|
|
81
|
-
> tbody,
|
|
82
|
-
> tfoot
|
|
83
|
-
> tr > td
|
|
84
|
-
background: $color-white
|
|
85
|
-
|
|
86
|
-
// Add top/top-left/top-right borders to the thead cells, using the special
|
|
87
|
-
// convention that they're added to the first element inside them instead of
|
|
88
|
-
// the cell itself, so buttons can keep the border themselves and display
|
|
89
|
-
// focus nicely.
|
|
90
|
-
> thead > tr > th
|
|
91
|
-
// Use `:not(:focus)` to avoid overriding button focus border styling.
|
|
92
|
-
> *
|
|
93
|
-
box-sizing: content-box
|
|
94
|
-
&:not(:focus)
|
|
95
|
-
+table-border
|
|
96
|
-
&
|
|
97
|
-
+table-border-top
|
|
98
|
-
+table-border-bottom
|
|
99
|
-
+table-border-left
|
|
100
|
-
+table-border-right
|
|
101
|
-
&:first-child > *
|
|
102
|
-
+table-border-top-left
|
|
103
|
-
&:last-child > *
|
|
104
|
-
+table-border-top-right
|
|
105
|
-
& + th > *
|
|
106
|
-
margin-left: -1px
|
|
107
|
-
// Don't cover the focused border of buttons:
|
|
108
|
-
&:focus
|
|
109
|
-
z-index: 1
|
|
110
|
-
|
|
111
|
-
// Add left/rigth borders to the normal tbody cells.
|
|
112
|
-
> tbody > tr > td
|
|
113
|
-
border: 0
|
|
114
|
-
+table-border
|
|
115
|
-
&:first-child
|
|
116
|
-
+table-border-left
|
|
117
|
-
&:last-child
|
|
118
|
-
+table-border-right
|
|
119
|
-
|
|
120
|
-
// If there is no thead, add top/top-left/top-right borders borders to the
|
|
121
|
-
// first row of the tbody cells.
|
|
122
|
-
> tbody:first-child > tr:first-child > td,
|
|
123
|
-
// Use :first-child to exclude situation where there's a thead and empty tbody
|
|
124
|
-
> tbody:first-child:empty + tfoot > tr > td
|
|
125
|
-
+table-border-top
|
|
126
|
-
&:first-child
|
|
127
|
-
+table-border-top-left
|
|
128
|
-
&:last-child
|
|
129
|
-
+table-border-top-right
|
|
130
|
-
|
|
131
|
-
// If there is no toot, add top/top-left/top-right borders borders to the
|
|
132
|
-
// first row of the tbody cells.
|
|
133
|
-
> tbody:last-child > tr:last-child > td
|
|
134
|
-
+table-border-bottom
|
|
135
|
-
&:first-child
|
|
136
|
-
+table-border-bottom-left
|
|
137
|
-
&:last-child
|
|
138
|
-
+table-border-bottom-right
|
|
139
|
-
|
|
140
|
-
// Add bottom/bottom-left/bottom-right borders to the thead cells.
|
|
141
|
-
> tfoot > tr > td
|
|
142
|
-
border-width: 0
|
|
143
|
-
+table-border
|
|
144
|
-
+table-border-bottom
|
|
145
|
-
&:first-child
|
|
146
|
-
+table-border-bottom-left
|
|
147
|
-
&:last-child
|
|
148
|
-
+table-border-bottom-right
|
|
149
|
-
|
|
150
|
-
// Nested .dito-table:
|
|
151
|
-
table.dito-table table.dito-table,
|
|
152
|
-
.dito-form-nested table.dito-table
|
|
153
|
-
margin: 0
|
package/src/styles/style.sass
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
@import '_imports'
|
|
2
|
-
// No need to import `_imports.sass` again, since it's handled by sass-loader.
|
|
3
|
-
@import '_base'
|
|
4
|
-
@import '_button'
|
|
5
|
-
@import '_pulldown'
|
|
6
|
-
@import '_layout'
|
|
7
|
-
@import '_scroll'
|
|
8
|
-
@import '_sortable'
|
|
9
|
-
@import '_table'
|
|
10
|
-
@import '_notifications'
|
package/src/types/TypeButton.vue
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<template lang="pug">
|
|
2
|
-
button.dito-button(
|
|
3
|
-
ref="element"
|
|
4
|
-
:id="dataPath"
|
|
5
|
-
:type="type"
|
|
6
|
-
:title="text"
|
|
7
|
-
:class="`dito-button-${verb}`"
|
|
8
|
-
v-bind="attributes"
|
|
9
|
-
) {{ text }}
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
import TypeComponent from '../TypeComponent.js'
|
|
14
|
-
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
15
|
-
import { hasResource } from '../utils/resource.js'
|
|
16
|
-
import { labelize } from '@ditojs/utils'
|
|
17
|
-
|
|
18
|
-
export default TypeComponent.register([
|
|
19
|
-
'button', 'submit'
|
|
20
|
-
],
|
|
21
|
-
// @vue/component
|
|
22
|
-
{
|
|
23
|
-
defaultValue: () => undefined, // Callback to override `defaultValue: null`
|
|
24
|
-
excludeValue: true,
|
|
25
|
-
defaultWidth: 'auto',
|
|
26
|
-
// TODO: Consider making this work nicely:
|
|
27
|
-
// omitFlexGrow: true,
|
|
28
|
-
|
|
29
|
-
computed: {
|
|
30
|
-
verb() {
|
|
31
|
-
return this.verbs[this.name] || this.name
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
text: getSchemaAccessor('text', {
|
|
35
|
-
type: String,
|
|
36
|
-
get(text) {
|
|
37
|
-
return text || labelize(this.verb)
|
|
38
|
-
}
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
closeForm: getSchemaAccessor('closeForm', {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: false
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
// @override
|
|
47
|
-
events() {
|
|
48
|
-
const { onFocus, onBlur, onClick } = this
|
|
49
|
-
return { onFocus, onBlur, onClick }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
methods: {
|
|
55
|
-
async submit(options) {
|
|
56
|
-
return this.resourceComponent?.submit(this, options)
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
async onClick() {
|
|
60
|
-
const res = await this.emitEvent('click', {
|
|
61
|
-
parent: this.schemaComponent
|
|
62
|
-
})
|
|
63
|
-
// Have buttons that define resources call `this.submit()` by default:
|
|
64
|
-
if (
|
|
65
|
-
res === undefined && // Meaning: don't prevent default.
|
|
66
|
-
hasResource(this.schema)
|
|
67
|
-
) {
|
|
68
|
-
await this.submit()
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
</script>
|