mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-14 04:08:19 +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}
|
||||
label={attribute?.label}
|
||||
placeholder={attribute?.label}
|
||||
type={attribute?.type}
|
||||
{maxWidth}
|
||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||
space={object.space}
|
||||
@ -97,6 +98,7 @@
|
||||
this={instance}
|
||||
label={attribute?.label}
|
||||
placeholder={attribute?.label}
|
||||
type={attribute?.type}
|
||||
{maxWidth}
|
||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||
space={object.space}
|
||||
@ -113,6 +115,7 @@
|
||||
this={instance}
|
||||
label={attribute?.label}
|
||||
placeholder={attribute?.label}
|
||||
type={attribute?.type}
|
||||
{maxWidth}
|
||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||
space={object.space}
|
||||
@ -130,6 +133,7 @@
|
||||
placeholder={attribute?.label}
|
||||
kind={'link'}
|
||||
size={'large'}
|
||||
type={attribute?.type}
|
||||
{maxWidth}
|
||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||
space={object.space}
|
||||
@ -142,6 +146,7 @@
|
||||
<div style="grid-column: 1/3;">
|
||||
<svelte:component
|
||||
this={instance}
|
||||
type={attribute?.type}
|
||||
{maxWidth}
|
||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||
space={object.space}
|
||||
|
@ -59,6 +59,7 @@
|
||||
this={instance}
|
||||
label={attribute?.label}
|
||||
placeholder={attribute?.label}
|
||||
type={attribute?.type}
|
||||
{maxWidth}
|
||||
value={getAttribute(client, object, { key: attributeKey, attr: attribute })}
|
||||
{onChange}
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
export let value: any
|
||||
export let maxWidth: string | undefined = undefined
|
||||
export let withoutUndefined: boolean = false
|
||||
export let onChange: (value: any) => void
|
||||
</script>
|
||||
|
||||
@ -31,7 +32,7 @@
|
||||
style={maxWidth ? `max-width: ${maxWidth};` : ''}
|
||||
on:click={() => {
|
||||
if (value === true) value = false
|
||||
else if (value === false) value = undefined
|
||||
else if (value === false && !withoutUndefined) value = undefined
|
||||
else value = true
|
||||
onChange(value)
|
||||
}}
|
||||
|
@ -1,6 +1,5 @@
|
||||
<!--
|
||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
||||
// Copyright © 2021 Hardcore Engineering Inc.
|
||||
// Copyright © 2022 Hardcore Engineering Inc.
|
||||
//
|
||||
// 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
|
||||
@ -9,23 +8,26 @@
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
//
|
||||
//
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
// import { TypeDate } from '@anticrm/core'
|
||||
import { TypeDate } from '@anticrm/core'
|
||||
// import { IntlString } from '@anticrm/platform'
|
||||
import { DateRangePresenter } from '@anticrm/ui'
|
||||
|
||||
export let value: number | null | undefined
|
||||
export let type: TypeDate | undefined
|
||||
// export let label: IntlString
|
||||
export let onChange: (value: any) => void
|
||||
|
||||
$: withTime = type?.withTime ?? true
|
||||
</script>
|
||||
|
||||
<DateRangePresenter
|
||||
{value}
|
||||
withTime
|
||||
{withTime}
|
||||
editable
|
||||
on:change={(res) => {
|
||||
if (res.detail !== undefined) onChange(res.detail)
|
||||
|
@ -32,9 +32,10 @@
|
||||
<Label label={view.string.WithTime} />
|
||||
<div class="ml-2">
|
||||
<BooleanEditor
|
||||
withoutUndefined
|
||||
bind:value={withTime}
|
||||
onChange={(e) => {
|
||||
dispatch('change', TypeDate(e))
|
||||
dispatch('change', { type: TypeDate(e) })
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user