mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-27 20:14:57 +02:00
Add subprocess match trigger (#10101)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -16,10 +16,11 @@
|
||||
<script lang="ts">
|
||||
import { AnyAttribute } from '@hcengineering/core'
|
||||
import { Context, Process } from '@hcengineering/process'
|
||||
import { Component, DropdownLabelsIntl } from '@hcengineering/ui'
|
||||
import { Component } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { buildResult, Mode, ModeId, Modes, parseValue } from '../../query'
|
||||
import BaseCriteriaEditor from './BaseCriteriaEditor.svelte'
|
||||
import ModeSelector from './ModeSelector.svelte'
|
||||
|
||||
export let readonly: boolean
|
||||
export let value: any
|
||||
@@ -32,7 +33,6 @@
|
||||
|
||||
let [val, selectedMode] = parseValue(modesValues, value)
|
||||
|
||||
$: mode = selectedMode.id
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
$: [val, selectedMode] = parseValue(modesValues, value)
|
||||
@@ -42,27 +42,18 @@
|
||||
value = result
|
||||
dispatch('change', result)
|
||||
}
|
||||
|
||||
function changeMode (e: CustomEvent): void {
|
||||
const editorChanged = e.detail
|
||||
if (editorChanged) {
|
||||
val = undefined
|
||||
}
|
||||
changeResult(val)
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex-row-center flex-gap-4">
|
||||
<DropdownLabelsIntl
|
||||
items={modesValues}
|
||||
selected={mode}
|
||||
disabled={readonly}
|
||||
minW0={false}
|
||||
kind={'no-border'}
|
||||
width={'100%'}
|
||||
on:selected={(e) => {
|
||||
mode = e.detail
|
||||
const prevEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
|
||||
selectedMode = modesValues.find((m) => m.id === mode) ?? modesValues[0]
|
||||
const newEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
|
||||
if (prevEditor !== newEditor) {
|
||||
val = undefined
|
||||
}
|
||||
changeResult(val)
|
||||
}}
|
||||
/>
|
||||
<ModeSelector bind:selectedMode modes={modesValues} {readonly} on:change={changeMode} />
|
||||
{#if selectedMode.editor}
|
||||
<div class="w-full">
|
||||
<Component
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<!--
|
||||
// Copyright © 2025 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
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// 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 { DropdownLabelsIntl } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { Mode } from '../../query'
|
||||
|
||||
export let selectedMode: Mode
|
||||
export let readonly: boolean
|
||||
export let modes: Mode[] = []
|
||||
|
||||
$: mode = selectedMode.id
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
</script>
|
||||
|
||||
<DropdownLabelsIntl
|
||||
items={modes}
|
||||
selected={mode}
|
||||
disabled={readonly}
|
||||
minW0={false}
|
||||
kind={'no-border'}
|
||||
width={'100%'}
|
||||
on:selected={(e) => {
|
||||
mode = e.detail
|
||||
const prevEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
|
||||
selectedMode = modes.find((m) => m.id === mode) ?? modes[0]
|
||||
const newEditor = (selectedMode.editor ?? selectedMode.withoutEditor) ? null : undefined
|
||||
dispatch('change', prevEditor !== newEditor)
|
||||
}}
|
||||
/>
|
||||
@@ -0,0 +1,73 @@
|
||||
<!--
|
||||
// Copyright © 2025 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
|
||||
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
||||
//
|
||||
// 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 { Ref, SortingOrder } from '@hcengineering/core'
|
||||
import { Process, State } from '@hcengineering/process'
|
||||
import { Dropdown, DropdownLabels } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import plugin from '../../plugin'
|
||||
import { buildResult, Modes, parseValue } from '../../query'
|
||||
import ModeSelector from './ModeSelector.svelte'
|
||||
import { ObjectBox } from '@hcengineering/view-resources'
|
||||
import { createQuery } from '@hcengineering/presentation'
|
||||
|
||||
export let readonly: boolean
|
||||
export let target: Ref<Process> | undefined
|
||||
export let value: any
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
const modes = [Modes.ArrayAll, Modes.ArrayAny, Modes.ArrayNotIncludes]
|
||||
|
||||
let [val, selectedMode] = parseValue(modes, value)
|
||||
$: [val, selectedMode] = parseValue(modes, value)
|
||||
|
||||
function changeMode (): void {
|
||||
value = buildResult(selectedMode, val)
|
||||
dispatch('change', value)
|
||||
}
|
||||
|
||||
function change (e: CustomEvent): void {
|
||||
val = e.detail ?? []
|
||||
value = buildResult(selectedMode, val)
|
||||
dispatch('change', value)
|
||||
}
|
||||
|
||||
const query = createQuery()
|
||||
let states: State[] = []
|
||||
$: query.query(
|
||||
plugin.class.State,
|
||||
{ process: target },
|
||||
(items) => {
|
||||
states = items
|
||||
},
|
||||
{ sort: { rank: SortingOrder.Ascending } }
|
||||
)
|
||||
|
||||
$: selected = states.filter((state) => val?.includes(state._id))?.map((p) => p._id)
|
||||
</script>
|
||||
|
||||
<div class="flex-row-center flex-gap-4">
|
||||
<ModeSelector bind:selectedMode {modes} {readonly} on:change={changeMode} />
|
||||
<DropdownLabels
|
||||
useFlexGrow
|
||||
width={'100%'}
|
||||
multiselect={true}
|
||||
items={states.map((state) => ({ id: state._id, label: state.title }))}
|
||||
{selected}
|
||||
on:selected={change}
|
||||
/>
|
||||
</div>
|
||||
Reference in New Issue
Block a user