mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-21 15:59:15 +00:00
Provide attribute type data to editor (#1691)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
03cb718c72
commit
64a8a27265
@ -76,6 +76,7 @@
|
|||||||
this={instance}
|
this={instance}
|
||||||
label={attribute?.label}
|
label={attribute?.label}
|
||||||
placeholder={attribute?.label}
|
placeholder={attribute?.label}
|
||||||
|
type={attribute?.type}
|
||||||
{maxWidth}
|
{maxWidth}
|
||||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||||
space={object.space}
|
space={object.space}
|
||||||
@ -97,6 +98,7 @@
|
|||||||
this={instance}
|
this={instance}
|
||||||
label={attribute?.label}
|
label={attribute?.label}
|
||||||
placeholder={attribute?.label}
|
placeholder={attribute?.label}
|
||||||
|
type={attribute?.type}
|
||||||
{maxWidth}
|
{maxWidth}
|
||||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||||
space={object.space}
|
space={object.space}
|
||||||
@ -113,6 +115,7 @@
|
|||||||
this={instance}
|
this={instance}
|
||||||
label={attribute?.label}
|
label={attribute?.label}
|
||||||
placeholder={attribute?.label}
|
placeholder={attribute?.label}
|
||||||
|
type={attribute?.type}
|
||||||
{maxWidth}
|
{maxWidth}
|
||||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||||
space={object.space}
|
space={object.space}
|
||||||
@ -130,6 +133,7 @@
|
|||||||
placeholder={attribute?.label}
|
placeholder={attribute?.label}
|
||||||
kind={'link'}
|
kind={'link'}
|
||||||
size={'large'}
|
size={'large'}
|
||||||
|
type={attribute?.type}
|
||||||
{maxWidth}
|
{maxWidth}
|
||||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||||
space={object.space}
|
space={object.space}
|
||||||
@ -142,6 +146,7 @@
|
|||||||
<div style="grid-column: 1/3;">
|
<div style="grid-column: 1/3;">
|
||||||
<svelte:component
|
<svelte:component
|
||||||
this={instance}
|
this={instance}
|
||||||
|
type={attribute?.type}
|
||||||
{maxWidth}
|
{maxWidth}
|
||||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||||
space={object.space}
|
space={object.space}
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
this={instance}
|
this={instance}
|
||||||
label={attribute?.label}
|
label={attribute?.label}
|
||||||
placeholder={attribute?.label}
|
placeholder={attribute?.label}
|
||||||
|
type={attribute?.type}
|
||||||
{maxWidth}
|
{maxWidth}
|
||||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||||
{onChange}
|
{onChange}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
export let value: any
|
export let value: any
|
||||||
export let maxWidth: string | undefined = undefined
|
export let maxWidth: string | undefined = undefined
|
||||||
|
export let withoutUndefined: boolean = false
|
||||||
export let onChange: (value: any) => void
|
export let onChange: (value: any) => void
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -31,7 +32,7 @@
|
|||||||
style={maxWidth ? `max-width: ${maxWidth};` : ''}
|
style={maxWidth ? `max-width: ${maxWidth};` : ''}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
if (value === true) value = false
|
if (value === true) value = false
|
||||||
else if (value === false) value = undefined
|
else if (value === false && !withoutUndefined) value = undefined
|
||||||
else value = true
|
else value = true
|
||||||
onChange(value)
|
onChange(value)
|
||||||
}}
|
}}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
// Copyright © 2022 Hardcore Engineering Inc.
|
||||||
// Copyright © 2021 Hardcore Engineering Inc.
|
|
||||||
//
|
//
|
||||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License. You may
|
// you may not use this file except in compliance with the License. You may
|
||||||
@ -14,18 +13,21 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// import { TypeDate } from '@anticrm/core'
|
import { TypeDate } from '@anticrm/core'
|
||||||
// import { IntlString } from '@anticrm/platform'
|
// import { IntlString } from '@anticrm/platform'
|
||||||
import { DateRangePresenter } from '@anticrm/ui'
|
import { DateRangePresenter } from '@anticrm/ui'
|
||||||
|
|
||||||
export let value: number | null | undefined
|
export let value: number | null | undefined
|
||||||
|
export let type: TypeDate | undefined
|
||||||
// export let label: IntlString
|
// export let label: IntlString
|
||||||
export let onChange: (value: any) => void
|
export let onChange: (value: any) => void
|
||||||
|
|
||||||
|
$: withTime = type?.withTime ?? true
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<DateRangePresenter
|
<DateRangePresenter
|
||||||
{value}
|
{value}
|
||||||
withTime
|
{withTime}
|
||||||
editable
|
editable
|
||||||
on:change={(res) => {
|
on:change={(res) => {
|
||||||
if (res.detail !== undefined) onChange(res.detail)
|
if (res.detail !== undefined) onChange(res.detail)
|
||||||
|
@ -32,9 +32,10 @@
|
|||||||
<Label label={view.string.WithTime} />
|
<Label label={view.string.WithTime} />
|
||||||
<div class="ml-2">
|
<div class="ml-2">
|
||||||
<BooleanEditor
|
<BooleanEditor
|
||||||
|
withoutUndefined
|
||||||
bind:value={withTime}
|
bind:value={withTime}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
dispatch('change', TypeDate(e))
|
dispatch('change', { type: TypeDate(e) })
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user