markup check filled (#10817)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2026-05-03 15:53:23 +05:00
committed by GitHub
parent 1dc41f0b1d
commit c6738a02cb
5 changed files with 66 additions and 0 deletions
+3
View File
@@ -24762,6 +24762,9 @@ importers:
'@hcengineering/setting-resources':
specifier: workspace:^0.7.0
version: link:../setting-resources
'@hcengineering/text-core':
specifier: workspace:^0.7.19
version: link:../../foundations/core/packages/text-core
'@hcengineering/time':
specifier: workspace:^0.7.0
version: link:../time
+18
View File
@@ -797,6 +797,24 @@ export function createModel (builder: Builder): void {
}
})
builder.createDoc(process.class.UpdateCriteriaComponent, core.space.Model, {
category: 'attribute',
editor: process.criteriaEditor.BaseCriteria,
of: core.class.TypeMarkup,
props: {
modes: ['StringContains', 'Exists']
}
})
builder.createDoc(process.class.UpdateCriteriaComponent, core.space.Model, {
category: 'inplace',
editor: process.criteriaEditor.BaseCriteria,
of: core.class.TypeMarkup,
props: {
modes: ['StringContains', 'Exists']
}
})
builder.createDoc(process.class.UpdateCriteriaComponent, core.space.Model, {
category: 'attribute',
editor: process.criteriaEditor.BaseCriteria,
+1
View File
@@ -59,6 +59,7 @@
"@hcengineering/platform": "workspace:^0.7.20",
"@hcengineering/process": "workspace:^0.7.0",
"@hcengineering/login": "workspace:^0.7.0",
"@hcengineering/text-core": "workspace:^0.7.19",
"@hcengineering/account-client": "workspace:^0.7.25",
"svelte": "^4.2.20",
"fast-equals": "^5.2.2"
+22
View File
@@ -58,6 +58,7 @@ import {
type UpdateCriteriaComponent,
type UserResult
} from '@hcengineering/process'
import { isEmptyMarkup } from '@hcengineering/text-core'
import { showPopup } from '@hcengineering/ui'
import { type AttributeCategory } from '@hcengineering/view'
import process from './plugin'
@@ -821,6 +822,17 @@ export async function approveRequestRejected (
return context.todo?.group === params._id && context.todo?.approved === false
}
function getMarkupParams (card: Card, params: Record<string, any>, client: Client): Record<string, any> {
const markup: Record<string, any> = {}
for (const [key, value] of Object.entries(params)) {
const attr = client.getHierarchy().findAttribute(card._class, key)
if (attr?.type?._class === core.class.TypeMarkup) {
markup[key] = value
}
}
return markup
}
export function matchCardCheck (
client: Client,
execution: Execution,
@@ -834,6 +846,11 @@ export function matchCardCheck (
if (client.getHierarchy().isMixin(process.masterTag)) {
doc = client.getHierarchy().as(doc, process.masterTag)
}
const markup = getMarkupParams(doc, params, client)
for (const key of Object.keys(markup)) {
if (isEmptyMarkup(doc[key])) return false
}
const res = matchQuery([doc], params, doc._class, client.getHierarchy(), true)
return res.length > 0
}
@@ -849,6 +866,11 @@ export function fieldChangesCheck (
const operations = (context.operations ?? {}) as DocumentUpdate<Doc>
const target = Object.keys(params)[0]
if (!TxProcessor.hasUpdate(operations, target)) return false
const markup = getMarkupParams(doc, params, client)
for (const key of Object.keys(markup)) {
if (isEmptyMarkup(doc[key])) return false
}
const res = matchQuery([doc], params, doc._class, client.getHierarchy(), true)
return res.length > 0
}
@@ -48,6 +48,7 @@ import process, {
UserResult
} from '@hcengineering/process'
import { ExecuteResult, ProcessControl, SuccessExecutionContext } from '@hcengineering/server-process'
import { isEmptyMarkup } from '@hcengineering/text-core'
import time, { ToDoPriority } from '@hcengineering/time'
function checkResult (execution: Execution, results: Record<string, any> | undefined): boolean {
@@ -146,10 +147,26 @@ export function MatchCardCheck (
if (context.card === undefined) return false
const process = control.client.getModel().findObject(execution.process)
if (process === undefined) return false
const markup = getMarkupParams(context.card, params, control)
for (const key of Object.keys(markup)) {
if (isEmptyMarkup(context.card[key])) return false
}
const res = matchQuery([context.card], params, process.masterTag, control.client.getHierarchy(), true)
return res.length > 0
}
function getMarkupParams (card: Card, params: Record<string, any>, control: ProcessControl): Record<string, any> {
const markup: Record<string, any> = {}
for (const [key, value] of Object.entries(params)) {
const attr = control.client.getHierarchy().findAttribute(card._class, key)
if (attr?.type?._class === core.class.TypeMarkup) {
markup[key] = value
}
}
return markup
}
export function EventCheck (
control: ProcessControl,
execution: Execution,
@@ -173,6 +190,11 @@ export function FieldChangedCheck (
const operations = context.operations as DocumentUpdate<Doc>
const target = Object.keys(params)[0]
if (!TxProcessor.hasUpdate(operations, target)) return false
const markup = getMarkupParams(context.card, params, control)
for (const key of Object.keys(markup)) {
if (isEmptyMarkup(context.card[key])) return false
}
const res = matchQuery([context.card], params, process.masterTag, control.client.getHierarchy(), true)
return res.length > 0
}