@radio-garden/ditojs-admin 2.85.2-0.5067ad799
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/README.md +180 -0
- package/dist/dito-admin.css +1 -0
- package/dist/dito-admin.es.js +12106 -0
- package/dist/dito-admin.umd.js +7 -0
- package/package.json +96 -0
- package/src/DitoAdmin.js +293 -0
- package/src/DitoComponent.js +34 -0
- package/src/DitoContext.js +318 -0
- package/src/DitoTypeComponent.js +42 -0
- package/src/DitoUser.js +12 -0
- package/src/appState.js +12 -0
- package/src/components/DitoAccount.vue +60 -0
- package/src/components/DitoAffix.vue +68 -0
- package/src/components/DitoAffixes.vue +200 -0
- package/src/components/DitoButtons.vue +80 -0
- package/src/components/DitoClipboard.vue +186 -0
- package/src/components/DitoContainer.vue +374 -0
- package/src/components/DitoCreateButton.vue +146 -0
- package/src/components/DitoDialog.vue +242 -0
- package/src/components/DitoDraggable.vue +117 -0
- package/src/components/DitoEditButtons.vue +135 -0
- package/src/components/DitoErrors.vue +83 -0
- package/src/components/DitoForm.vue +521 -0
- package/src/components/DitoFormInner.vue +26 -0
- package/src/components/DitoFormNested.vue +17 -0
- package/src/components/DitoHeader.vue +84 -0
- package/src/components/DitoLabel.vue +200 -0
- package/src/components/DitoMenu.vue +186 -0
- package/src/components/DitoNavigation.vue +40 -0
- package/src/components/DitoNotifications.vue +170 -0
- package/src/components/DitoPagination.vue +42 -0
- package/src/components/DitoPane.vue +334 -0
- package/src/components/DitoPanel.vue +256 -0
- package/src/components/DitoPanels.vue +61 -0
- package/src/components/DitoRoot.vue +524 -0
- package/src/components/DitoSchema.vue +846 -0
- package/src/components/DitoSchemaInlined.vue +97 -0
- package/src/components/DitoScopes.vue +76 -0
- package/src/components/DitoSidebar.vue +50 -0
- package/src/components/DitoSpinner.vue +95 -0
- package/src/components/DitoTableCell.vue +64 -0
- package/src/components/DitoTableHead.vue +121 -0
- package/src/components/DitoTabs.vue +103 -0
- package/src/components/DitoTrail.vue +124 -0
- package/src/components/DitoTreeItem.vue +420 -0
- package/src/components/DitoUploadFile.vue +199 -0
- package/src/components/DitoVNode.vue +14 -0
- package/src/components/DitoView.vue +143 -0
- package/src/components/index.js +42 -0
- package/src/directives/resize.js +83 -0
- package/src/index.js +1 -0
- package/src/mixins/ContextMixin.js +68 -0
- package/src/mixins/DataMixin.js +131 -0
- package/src/mixins/DitoMixin.js +591 -0
- package/src/mixins/DomMixin.js +29 -0
- package/src/mixins/EmitterMixin.js +158 -0
- package/src/mixins/ItemMixin.js +144 -0
- package/src/mixins/LoadingMixin.js +23 -0
- package/src/mixins/NumberMixin.js +118 -0
- package/src/mixins/OptionsMixin.js +304 -0
- package/src/mixins/PulldownMixin.js +63 -0
- package/src/mixins/ResourceMixin.js +398 -0
- package/src/mixins/RouteMixin.js +190 -0
- package/src/mixins/SchemaParentMixin.js +33 -0
- package/src/mixins/SortableMixin.js +49 -0
- package/src/mixins/SourceMixin.js +734 -0
- package/src/mixins/TextMixin.js +26 -0
- package/src/mixins/TypeMixin.js +280 -0
- package/src/mixins/ValidationMixin.js +119 -0
- package/src/mixins/ValidatorMixin.js +57 -0
- package/src/mixins/ValueMixin.js +31 -0
- package/src/styles/_base.scss +17 -0
- package/src/styles/_button.scss +191 -0
- package/src/styles/_imports.scss +3 -0
- package/src/styles/_info.scss +19 -0
- package/src/styles/_layout.scss +19 -0
- package/src/styles/_pulldown.scss +38 -0
- package/src/styles/_scroll.scss +13 -0
- package/src/styles/_settings.scss +88 -0
- package/src/styles/_table.scss +223 -0
- package/src/styles/_tippy.scss +45 -0
- package/src/styles/style.scss +9 -0
- package/src/types/DitoTypeButton.vue +143 -0
- package/src/types/DitoTypeCheckbox.vue +27 -0
- package/src/types/DitoTypeCheckboxes.vue +65 -0
- package/src/types/DitoTypeCode.vue +199 -0
- package/src/types/DitoTypeColor.vue +272 -0
- package/src/types/DitoTypeComponent.vue +31 -0
- package/src/types/DitoTypeComputed.vue +50 -0
- package/src/types/DitoTypeDate.vue +99 -0
- package/src/types/DitoTypeLabel.vue +23 -0
- package/src/types/DitoTypeList.vue +364 -0
- package/src/types/DitoTypeMarkup.vue +700 -0
- package/src/types/DitoTypeMultiselect.vue +522 -0
- package/src/types/DitoTypeNumber.vue +66 -0
- package/src/types/DitoTypeObject.vue +136 -0
- package/src/types/DitoTypePanel.vue +18 -0
- package/src/types/DitoTypeProgress.vue +40 -0
- package/src/types/DitoTypeRadio.vue +45 -0
- package/src/types/DitoTypeSection.vue +80 -0
- package/src/types/DitoTypeSelect.vue +133 -0
- package/src/types/DitoTypeSlider.vue +66 -0
- package/src/types/DitoTypeSpacer.vue +11 -0
- package/src/types/DitoTypeSwitch.vue +40 -0
- package/src/types/DitoTypeText.vue +101 -0
- package/src/types/DitoTypeTextarea.vue +48 -0
- package/src/types/DitoTypeTreeList.vue +193 -0
- package/src/types/DitoTypeUpload.vue +503 -0
- package/src/types/index.js +30 -0
- package/src/utils/SchemaGraph.js +147 -0
- package/src/utils/accessor.js +75 -0
- package/src/utils/agent.js +47 -0
- package/src/utils/data.js +92 -0
- package/src/utils/filter.js +266 -0
- package/src/utils/math.js +14 -0
- package/src/utils/options.js +48 -0
- package/src/utils/path.js +5 -0
- package/src/utils/resource.js +44 -0
- package/src/utils/route.js +53 -0
- package/src/utils/schema.js +1121 -0
- package/src/utils/type.js +81 -0
- package/src/utils/uid.js +15 -0
- package/src/utils/units.js +5 -0
- package/src/validators/_creditcard.js +6 -0
- package/src/validators/_decimals.js +11 -0
- package/src/validators/_domain.js +6 -0
- package/src/validators/_email.js +6 -0
- package/src/validators/_hostname.js +6 -0
- package/src/validators/_integer.js +6 -0
- package/src/validators/_max.js +6 -0
- package/src/validators/_min.js +6 -0
- package/src/validators/_password.js +5 -0
- package/src/validators/_range.js +6 -0
- package/src/validators/_required.js +9 -0
- package/src/validators/_url.js +6 -0
- package/src/validators/index.js +12 -0
- package/src/verbs.js +17 -0
- package/types/index.d.ts +3298 -0
- package/types/tests/admin.test-d.ts +27 -0
- package/types/tests/component-buttons.test-d.ts +44 -0
- package/types/tests/component-list.test-d.ts +159 -0
- package/types/tests/component-misc.test-d.ts +137 -0
- package/types/tests/component-object.test-d.ts +69 -0
- package/types/tests/component-section.test-d.ts +174 -0
- package/types/tests/component-select.test-d.ts +107 -0
- package/types/tests/components.test-d.ts +81 -0
- package/types/tests/context.test-d.ts +31 -0
- package/types/tests/fixtures.ts +24 -0
- package/types/tests/form.test-d.ts +109 -0
- package/types/tests/instance.test-d.ts +20 -0
- package/types/tests/schema-features.test-d.ts +402 -0
- package/types/tests/variance.test-d.ts +125 -0
- package/types/tests/view.test-d.ts +146 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isArray,
|
|
3
|
+
isObject,
|
|
4
|
+
isString,
|
|
5
|
+
isBoolean,
|
|
6
|
+
isNumber,
|
|
7
|
+
isFunction,
|
|
8
|
+
isDate,
|
|
9
|
+
isRegExp,
|
|
10
|
+
asArray
|
|
11
|
+
} from '@ditojs/utils'
|
|
12
|
+
|
|
13
|
+
const typeCheckers = {
|
|
14
|
+
Boolean: isBoolean,
|
|
15
|
+
Number: isNumber,
|
|
16
|
+
String: isString,
|
|
17
|
+
Date: isDate,
|
|
18
|
+
Array: isArray,
|
|
19
|
+
Object: isObject,
|
|
20
|
+
RegExp: isRegExp,
|
|
21
|
+
Function: isFunction
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Declare these separately from the `typeConverters` object, to prevent
|
|
25
|
+
// Babel issues with `Object` overriding the global `Object`:
|
|
26
|
+
const toBoolean = value => !!value
|
|
27
|
+
const toNumber = value => +value
|
|
28
|
+
const toString = value => String(value)
|
|
29
|
+
|
|
30
|
+
const toDate = value =>
|
|
31
|
+
isDate(value)
|
|
32
|
+
? value
|
|
33
|
+
: new Date(value)
|
|
34
|
+
|
|
35
|
+
const toArray = value =>
|
|
36
|
+
isArray(value)
|
|
37
|
+
? value
|
|
38
|
+
: isString(value)
|
|
39
|
+
? value.split(',')
|
|
40
|
+
: asArray(value)
|
|
41
|
+
|
|
42
|
+
const toObject = value =>
|
|
43
|
+
isObject(value)
|
|
44
|
+
? value
|
|
45
|
+
: // If a Object is expected but a Boolean provide, convert to an empty
|
|
46
|
+
// object. Used by `creatable` & co, that can be both.
|
|
47
|
+
value === true
|
|
48
|
+
? {}
|
|
49
|
+
: null
|
|
50
|
+
|
|
51
|
+
const toRegExp = value =>
|
|
52
|
+
isRegExp(value)
|
|
53
|
+
? value
|
|
54
|
+
: new RegExp(value)
|
|
55
|
+
|
|
56
|
+
const typeConverters = {
|
|
57
|
+
Boolean: toBoolean,
|
|
58
|
+
Number: toNumber,
|
|
59
|
+
String: toString,
|
|
60
|
+
Date: toDate,
|
|
61
|
+
Array: toArray,
|
|
62
|
+
Object: toObject,
|
|
63
|
+
RegExp: toRegExp
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function isMatchingType(types, value) {
|
|
67
|
+
// See if any of the expect types match, return immediately if they do:
|
|
68
|
+
if (types && value != null) {
|
|
69
|
+
for (const type of types) {
|
|
70
|
+
if (typeCheckers[type.name]?.(value)) {
|
|
71
|
+
return true
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return false
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function convertType(type, value) {
|
|
79
|
+
const converter = type && typeConverters[type.name || type]
|
|
80
|
+
return converter ? converter(value) : value
|
|
81
|
+
}
|
package/src/utils/uid.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { toRaw } from 'vue'
|
|
2
|
+
|
|
3
|
+
const uidMap = new WeakMap()
|
|
4
|
+
|
|
5
|
+
// Generated and remembers unique ids per passed object using a weak map.
|
|
6
|
+
let uid = 0
|
|
7
|
+
export function getUid(item, getItemId = null) {
|
|
8
|
+
const raw = toRaw(item)
|
|
9
|
+
let id = uidMap.get(raw)
|
|
10
|
+
if (!id && item) {
|
|
11
|
+
id = getItemId?.(item) || `@${++uid}`
|
|
12
|
+
uidMap.set(raw, id)
|
|
13
|
+
}
|
|
14
|
+
return id
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const decimals = {
|
|
2
|
+
validate: (value, decimals) => {
|
|
3
|
+
const match = decimals === '*' ? '+' : `{1,${decimals}}`
|
|
4
|
+
return new RegExp(`^[-+]?\\d*(\\.\\d${match})?$`).test(value)
|
|
5
|
+
},
|
|
6
|
+
|
|
7
|
+
message: (value, decimals) =>
|
|
8
|
+
`must be numeric and may contain ${
|
|
9
|
+
!decimals || decimals === '*' ? '' : decimals
|
|
10
|
+
} decimal points`
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const required = {
|
|
2
|
+
validate: (value, settings, { password }) => (
|
|
3
|
+
(value != null && value !== '') ||
|
|
4
|
+
// Password fields use `undefined` as opposed to `null` when they're set
|
|
5
|
+
// but unchanged, allow this to pass through:
|
|
6
|
+
(password && value === undefined)
|
|
7
|
+
),
|
|
8
|
+
message: 'is required'
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './_creditcard.js'
|
|
2
|
+
export * from './_decimals.js'
|
|
3
|
+
export * from './_email.js'
|
|
4
|
+
export * from './_hostname.js'
|
|
5
|
+
export * from './_domain.js'
|
|
6
|
+
export * from './_integer.js'
|
|
7
|
+
export * from './_max.js'
|
|
8
|
+
export * from './_min.js'
|
|
9
|
+
export * from './_password.js'
|
|
10
|
+
export * from './_range.js'
|
|
11
|
+
export * from './_required.js'
|
|
12
|
+
export * from './_url.js'
|
package/src/verbs.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
'create', 'created',
|
|
3
|
+
'save', 'saved',
|
|
4
|
+
'apply', 'applied',
|
|
5
|
+
'submit', 'submitted',
|
|
6
|
+
'delete', 'deleted',
|
|
7
|
+
'remove', 'removed',
|
|
8
|
+
'clear', 'cleared',
|
|
9
|
+
'edit', 'edited',
|
|
10
|
+
'close', 'closed',
|
|
11
|
+
'cancel', 'cancelled',
|
|
12
|
+
'drag', 'dragged',
|
|
13
|
+
'login', 'logged in'
|
|
14
|
+
].reduce((verbs, verb) => {
|
|
15
|
+
verbs[verb] = verb
|
|
16
|
+
return verbs
|
|
17
|
+
}, {})
|