@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,48 @@
|
|
|
1
|
+
// A mini-replication of vue's internal `resolveMergedOptions()` but only
|
|
2
|
+
// handling our own added options properties and merging them early instead
|
|
3
|
+
// of lazily.
|
|
4
|
+
|
|
5
|
+
export function resolveMergedOptions(options) {
|
|
6
|
+
const { mixins } = options
|
|
7
|
+
return mixins || options.extends
|
|
8
|
+
? mergeOptions(
|
|
9
|
+
{ ...options },
|
|
10
|
+
options
|
|
11
|
+
)
|
|
12
|
+
: options
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function mergeOptions(to, from) {
|
|
16
|
+
if (from.extends) {
|
|
17
|
+
mergeOptions(to, from.extends)
|
|
18
|
+
}
|
|
19
|
+
if (from.mixins) {
|
|
20
|
+
for (const mixin of from.mixins) {
|
|
21
|
+
mergeOptions(to, mixin)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
for (const key of ditoOptionKeys) {
|
|
25
|
+
if (key in from) {
|
|
26
|
+
to[key] = from[key]
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return to
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const ditoOptionKeys = [
|
|
33
|
+
'defaultValue',
|
|
34
|
+
'defaultNested',
|
|
35
|
+
'defaultVisible',
|
|
36
|
+
'generateLabel',
|
|
37
|
+
'excludeValue',
|
|
38
|
+
'ignoreMissingValue',
|
|
39
|
+
'omitSpacing',
|
|
40
|
+
'processValue',
|
|
41
|
+
'processSchema',
|
|
42
|
+
'getPanelSchema',
|
|
43
|
+
'getFormSchemasForProcessing',
|
|
44
|
+
// Vue 3 / Vue-router 4 forgets these.
|
|
45
|
+
// TODO: Create bug-report?
|
|
46
|
+
'beforeRouteUpdate',
|
|
47
|
+
'beforeRouteLeave'
|
|
48
|
+
]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { isFunction, isObject, isString, pickBy } from '@ditojs/utils'
|
|
2
|
+
|
|
3
|
+
export function hasResource(schema) {
|
|
4
|
+
return !!getResource(schema.resource)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getResource(resource, defaults = {}) {
|
|
8
|
+
const { parent, ...defs } = defaults
|
|
9
|
+
if (isFunction(resource)) {
|
|
10
|
+
resource = resource(defaults)
|
|
11
|
+
}
|
|
12
|
+
resource = isObject(resource)
|
|
13
|
+
? { ...defs, ...resource }
|
|
14
|
+
: isString(resource)
|
|
15
|
+
? { ...defs, path: resource }
|
|
16
|
+
: null
|
|
17
|
+
// Only set parent if path doesn't start with '/', so relative URLs are
|
|
18
|
+
// dealt with correctly.
|
|
19
|
+
if (
|
|
20
|
+
resource &&
|
|
21
|
+
parent !== undefined &&
|
|
22
|
+
resource.parent === undefined &&
|
|
23
|
+
!resource.path?.startsWith('/')
|
|
24
|
+
) {
|
|
25
|
+
resource.parent = parent
|
|
26
|
+
if (!resource.path) {
|
|
27
|
+
resource.path = '.'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return resource
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getMemberResource(id, resource) {
|
|
34
|
+
return id != null && resource?.type === 'collection'
|
|
35
|
+
? {
|
|
36
|
+
type: 'member',
|
|
37
|
+
...pickBy(
|
|
38
|
+
resource,
|
|
39
|
+
(value, key) => ['method', 'path', 'parent'].includes(key)
|
|
40
|
+
),
|
|
41
|
+
id: `${id}`
|
|
42
|
+
}
|
|
43
|
+
: null
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isArray } from '@ditojs/utils'
|
|
2
|
+
|
|
3
|
+
export function formatQuery(query) {
|
|
4
|
+
const entries = query
|
|
5
|
+
? isArray(query)
|
|
6
|
+
? query
|
|
7
|
+
: Object.entries(query)
|
|
8
|
+
: []
|
|
9
|
+
return (
|
|
10
|
+
new URLSearchParams(
|
|
11
|
+
// Expand array values into multiple entries under the same key, so
|
|
12
|
+
// `formatQuery({ foo: [1, 2], bar: 3 })` => 'foo=1&foo=2&bar=3'.
|
|
13
|
+
entries.reduce(
|
|
14
|
+
(entries, [key, value]) => {
|
|
15
|
+
if (isArray(value)) {
|
|
16
|
+
for (const val of value) {
|
|
17
|
+
// Prevent null or undefined values from becoming strings,
|
|
18
|
+
// but since they're entries in an array, we still include them.
|
|
19
|
+
entries.push([key, val ?? ''])
|
|
20
|
+
}
|
|
21
|
+
} else if (value != null) {
|
|
22
|
+
entries.push([key, value])
|
|
23
|
+
}
|
|
24
|
+
return entries
|
|
25
|
+
},
|
|
26
|
+
[]
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
.toString()
|
|
30
|
+
// decode all these encoded characters to have the same behavior as
|
|
31
|
+
// vue-router's own query encoding.
|
|
32
|
+
.replaceAll(/%(?:21|24|28|29|2C|2F|3A|3B|3D|3F|40)/g, decodeURIComponent)
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function replaceRoute({ path, query, hash }) {
|
|
37
|
+
// Preserve `history.state`, see:
|
|
38
|
+
// https://router.vuejs.org/guide/migration/#usage-of-history-state
|
|
39
|
+
const { location } = window
|
|
40
|
+
history.replaceState(
|
|
41
|
+
history.state,
|
|
42
|
+
null,
|
|
43
|
+
`${
|
|
44
|
+
location.origin
|
|
45
|
+
}${
|
|
46
|
+
path ?? location.pathname
|
|
47
|
+
}?${
|
|
48
|
+
query ? formatQuery(query) : location.search.slice(1)
|
|
49
|
+
}${
|
|
50
|
+
hash ?? location.hash
|
|
51
|
+
}`
|
|
52
|
+
)
|
|
53
|
+
}
|