soma-kit 0.1.11 → 0.1.12
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 +103 -110
- package/bin/soma-kit.mjs +1 -1
- package/bin/soma.mjs +22 -0
- package/package.json +13 -7
- package/packs/finance/reconcile-board.ts +5 -2
- package/packs/finance/reconcile-desk/compile.ts +3 -2
- package/spec/generated/kit-app.schema.json +776 -38
- package/spec/generated/kit-page.schema.json +1613 -224
- package/spec/kit-grammar.json +770 -529
- package/spec/kit-grammar.schema.json +1962 -392
- package/src/app/app-config.ts +371 -347
- package/src/app/component-gate.ts +12 -15
- package/src/app/compose-apps.ts +79 -8
- package/src/app/define-kit-actions.ts +245 -41
- package/src/app/define-kit-app.ts +174 -31
- package/src/app/define-kit-view.ts +100 -0
- package/src/app/envelope.ts +1 -161
- package/src/app/index.ts +13 -2
- package/src/app/kit-view-context.ts +290 -0
- package/src/app/notify-renderer.ts +1 -115
- package/src/app/paged-list-adapter.ts +1 -240
- package/src/app/server-pages.ts +8 -2
- package/src/app/server.ts +491 -101
- package/src/app/submit.types.ts +1 -1
- package/src/app/theme-endpoint.ts +63 -0
- package/src/app/theme-runtime-shared.ts +1 -0
- package/src/app/theme-runtime.ts +663 -0
- package/src/base/action-busy.ts +2 -2
- package/src/base/action-gate.ts +4 -255
- package/src/base/action-slots.ts +47 -0
- package/src/base/alert.ts +5 -3
- package/src/base/avatar.ts +2 -2
- package/src/base/button.ts +46 -29
- package/src/base/cascader.ts +11 -12
- package/src/base/check-core.ts +1 -1
- package/src/base/choice.ts +28 -26
- package/src/base/class-candidates.ts +17 -0
- package/src/base/color-picker.ts +6 -6
- package/src/base/combobox.ts +5 -3
- package/src/base/command-palette.ts +9 -5
- package/src/base/countdown.ts +1 -1
- package/src/base/date-range.ts +25 -11
- package/src/base/date.ts +85 -17
- package/src/base/divider.ts +2 -2
- package/src/base/fab.ts +11 -4
- package/src/base/image.ts +1 -1
- package/src/base/index.ts +9 -3
- package/src/base/input.ts +42 -13
- package/src/base/kbd.ts +3 -1
- package/src/base/link.ts +4 -4
- package/src/base/listbox-core.ts +50 -30
- package/src/base/loading-gate.ts +133 -0
- package/src/base/mentions.ts +5 -5
- package/src/base/menu-button.ts +6 -1
- package/src/base/menu-core.ts +4 -0
- package/src/base/motion/aura.ts +2 -2
- package/src/base/motion/hover-3d.ts +2 -2
- package/src/base/motion/hover-gallery.ts +2 -2
- package/src/base/motion/marquee.ts +2 -2
- package/src/base/motion/text-rotate.ts +2 -2
- package/src/base/number.ts +93 -80
- package/src/base/otp.ts +4 -1
- package/src/base/permission-gate.ts +6 -0
- package/src/base/popover.ts +40 -8
- package/src/base/popup.ts +79 -14
- package/src/base/price-text.ts +2 -2
- package/src/base/progress.ts +2 -2
- package/src/base/qr-code.ts +4 -4
- package/src/base/qty-stepper.ts +9 -3
- package/src/base/range.ts +2 -2
- package/src/base/rating.ts +1 -1
- package/src/base/segmented.ts +4 -0
- package/src/base/select.ts +4 -3
- package/src/base/shared.ts +221 -29
- package/src/base/swap.ts +4 -1
- package/src/base/switch.ts +1 -1
- package/src/base/tag-input.ts +14 -10
- package/src/base/tag.ts +5 -1
- package/src/base/text.ts +39 -6
- package/src/base/textarea.ts +37 -11
- package/src/base/time-picker.ts +12 -9
- package/src/base/tree-select.ts +15 -8
- package/src/base/upload.ts +34 -5
- package/src/base/virtual-list.ts +107 -1
- package/src/biz/approval-desk/compile.ts +23 -41
- package/src/biz/auth-panel/compile.ts +37 -52
- package/src/biz/auth-panel/index.ts +1 -1
- package/src/biz/category-crud/compile.ts +22 -36
- package/src/biz/checkout-page/compile.ts +21 -5
- package/src/biz/compose.ts +13 -27
- package/src/biz/define.ts +5 -4
- package/src/biz/import-wizard/compile.ts +22 -26
- package/src/biz/import-wizard/hub.ts +126 -61
- package/src/biz/import-wizard/shell.ts +3 -3
- package/src/biz/index.ts +3 -3
- package/src/biz/landing-page/compile.ts +19 -3
- package/src/biz/link/hub.ts +49 -20
- package/src/biz/link/shared.ts +115 -118
- package/src/biz/master-sub/compile.ts +31 -44
- package/src/biz/multi-board/compile.ts +34 -49
- package/src/biz/multi-board/index.ts +18 -1
- package/src/biz/multi-board/shell.ts +24 -15
- package/src/biz/notification-center/compile.ts +21 -33
- package/src/biz/page-templates/domain-templates.ts +80 -13
- package/src/biz/page-templates/result-page/compile.ts +11 -2
- package/src/biz/page-templates/shared.ts +34 -36
- package/src/biz/record-detail/compile.ts +47 -42
- package/src/biz/record-detail/index.ts +11 -1
- package/src/biz/settings-center/compile.ts +6 -5
- package/src/biz/shared/action-host.ts +91 -211
- package/src/biz/shared/compile-helpers.ts +80 -0
- package/src/biz/shared/coordinator.ts +486 -83
- package/src/biz/shared/index.ts +8 -2
- package/src/biz/shared/overlay-shell.ts +80 -0
- package/src/biz/shared/pipes.ts +43 -30
- package/src/biz/shared/remove-key.ts +6 -0
- package/src/biz/shared/remove-wire.ts +29 -0
- package/src/biz/shared/runtime-hub.ts +216 -24
- package/src/biz/single-form/compile.ts +15 -37
- package/src/biz/standard-crud/compile.ts +62 -107
- package/src/biz/standard-crud/shell.ts +16 -66
- package/src/biz/step-form/compile.ts +26 -97
- package/src/biz/step-form/hub.ts +34 -41
- package/src/biz/types.ts +4 -3
- package/src/cli/core-imports.ts +54 -0
- package/src/cli/kit-cli.ts +130 -26
- package/src/cli/kit-init.ts +222 -0
- package/src/cli/service-endpoint-check.ts +425 -0
- package/src/cli/source-path-check.d.mts +17 -0
- package/src/cli/source-path-check.mjs +334 -0
- package/src/cli/view-writes.ts +752 -0
- package/src/compile/action-host-attach.ts +21 -29
- package/src/compile/closed-set.ts +509 -0
- package/src/compile/compile-page.ts +219 -72
- package/src/compile/component-candidates.ts +1 -1
- package/src/compile/hints.ts +30 -1
- package/src/compile/index.ts +1 -0
- package/src/compile/kit-error.ts +1 -0
- package/src/compile/locate.ts +21 -1
- package/src/compile/parse.ts +370 -41
- package/src/compile/redirect.ts +6 -2
- package/src/compile/styles.ts +35 -2
- package/src/compile/types.ts +18 -2
- package/src/compile/view-check.ts +151 -0
- package/src/data/amount-breakdown.ts +2 -2
- package/src/data/anchor-nav.ts +2 -2
- package/src/data/approval-flow.ts +2 -2
- package/src/data/assignment-picker.ts +40 -29
- package/src/data/async-result-panel.ts +62 -6
- package/src/data/breadcrumbs.ts +2 -2
- package/src/data/calendar.ts +22 -25
- package/src/data/carousel.ts +5 -2
- package/src/data/chart.ts +42 -34
- package/src/data/checklist.ts +2 -2
- package/src/data/code-view.ts +4 -2
- package/src/data/comment-thread.ts +5 -2
- package/src/data/confirm-dialog.ts +10 -0
- package/src/data/context-menu.ts +29 -37
- package/src/data/d9-util.ts +2 -18
- package/src/data/diff.ts +4 -2
- package/src/data/dock.ts +2 -2
- package/src/data/embed.ts +2 -1
- package/src/data/field-mapper.ts +31 -26
- package/src/data/flow-editor-contract.ts +1 -1
- package/src/data/flow-editor.ts +89 -100
- package/src/data/flow-node-options.ts +90 -0
- package/src/data/flow-remote-options.ts +0 -103
- package/src/data/footer.ts +2 -2
- package/src/data/form-draft-registry.ts +2 -4
- package/src/data/gantt.ts +14 -17
- package/src/data/hero.ts +2 -2
- package/src/data/image-viewer.ts +20 -26
- package/src/data/index.ts +0 -2
- package/src/data/item-list.ts +31 -22
- package/src/data/kanban.ts +43 -42
- package/src/data/media-grid.ts +14 -19
- package/src/data/menu.ts +2 -2
- package/src/data/mockup.ts +2 -2
- package/src/data/modal-dialog.ts +22 -18
- package/src/data/navbar.ts +7 -2
- package/src/data/notify-renderer.ts +235 -0
- package/src/data/object-form.ts +1036 -648
- package/src/data/pager.ts +65 -29
- package/src/data/permission-matrix.ts +20 -21
- package/src/data/permission-tree.ts +28 -26
- package/src/data/pricing-table.ts +9 -3
- package/src/data/reaction-bar.ts +77 -88
- package/src/data/read-rollback.ts +73 -0
- package/src/data/record-card.ts +3 -3
- package/src/data/record-picker.ts +93 -50
- package/src/data/redirect.ts +32 -32
- package/src/data/remote-options.ts +13 -6
- package/src/data/request-console.ts +5 -3
- package/src/data/resident.ts +2 -1
- package/src/data/result-panel.ts +4 -2
- package/src/data/rich-text.ts +45 -55
- package/src/data/row-editor.ts +285 -52
- package/src/data/rule-builder.ts +18 -12
- package/src/data/shape-util.ts +4 -0
- package/src/data/stat-group.ts +243 -101
- package/src/data/static-registry.ts +22 -11
- package/src/data/steps.ts +2 -2
- package/src/data/survey.ts +24 -29
- package/src/data/system-switcher.ts +2 -2
- package/src/data/timeline.ts +2 -2
- package/src/data/tour-guide.ts +22 -29
- package/src/data/transfer.ts +27 -23
- package/src/data/tree-table.ts +96 -48
- package/src/data/tree.ts +27 -34
- package/src/data/trend-line.ts +6 -24
- package/src/data/virtual-rows.ts +118 -76
- package/src/data/watermark.ts +2 -2
- package/src/data/wrap.ts +63 -38
- package/src/frames/blank-frame.ts +1 -0
- package/src/frames/index.ts +2 -2
- package/src/frames/page-bar.ts +12 -11
- package/src/frames/page-header.ts +14 -5
- package/src/frames/page-status.ts +2 -2
- package/src/frames/shared.ts +23 -17
- package/src/frames/single-frame.ts +1 -0
- package/src/frames/split-frame/shell.ts +5 -5
- package/src/frames/split-frame/wiring.ts +2 -2
- package/src/frames/tabs-frame/shell.ts +2 -13
- package/src/frames/tabs-frame/wiring.ts +4 -8
- package/src/frames/top-main-frame.ts +1 -0
- package/src/frames/types.ts +13 -2
- package/src/frames/workspace-frame/extras.ts +20 -4
- package/src/frames/workspace-frame/index.ts +1 -1
- package/src/frames/workspace-frame/shell.ts +1 -0
- package/src/frames/workspace-frame/state.ts +13 -6
- package/src/frames/workspace-frame/view.ts +119 -25
- package/src/generated/kit-grammar-runtime.ts +430 -366
- package/src/generated/page-origin.ts +0 -11
- package/src/i18n/kit-text.ts +23 -27
- package/src/index.ts +2 -1
- package/src/object-renderer/action-gate.ts +11 -147
- package/src/object-renderer/arrange.ts +71 -77
- package/src/object-renderer/collapse-wiring.ts +2 -2
- package/src/object-renderer/collection-expand.ts +2 -2
- package/src/object-renderer/collection-parts.ts +216 -100
- package/src/object-renderer/collection-table.ts +180 -42
- package/src/object-renderer/collection.ts +95 -79
- package/src/object-renderer/compile-data.ts +85 -100
- package/src/object-renderer/crud-bridge.ts +32 -0
- package/src/object-renderer/defaults.ts +8 -14
- package/src/object-renderer/display-checks.ts +3 -24
- package/src/object-renderer/emit-events.ts +186 -172
- package/src/object-renderer/emit-object.ts +15 -2
- package/src/object-renderer/emit-static.ts +174 -132
- package/src/object-renderer/field-value.ts +593 -396
- package/src/object-renderer/filter-reload.ts +70 -0
- package/src/object-renderer/form-detail.ts +112 -2
- package/src/object-renderer/index.ts +26 -0
- package/src/object-renderer/key-field.ts +12 -0
- package/src/object-renderer/linkage.ts +7 -270
- package/src/object-renderer/merge-class.ts +18 -1
- package/src/object-renderer/path-pick.ts +27 -0
- package/src/object-renderer/render-object.ts +405 -86
- package/src/object-renderer/request-actions.ts +230 -249
- package/src/object-renderer/table-actions.ts +195 -95
- package/src/object-renderer/table-summary.ts +2 -2
- package/src/object-renderer/table-tools.ts +418 -84
- package/src/object-renderer/types.ts +128 -122
- package/src/object-renderer/view-binding.ts +196 -0
- package/src/page-target/ai-surface.ts +37 -0
- package/src/page-target/compile.ts +48 -8
- package/src/page-target/index.ts +8 -1
- package/src/page-target/intent-schema.ts +154 -28
- package/src/page-target/target.ts +257 -50
- package/src/page-target/writer-policy.ts +14 -3
- package/src/recipes/container.ts +165 -0
- package/src/recipes/control.ts +219 -0
- package/src/recipes/index.ts +263 -0
- package/src/recipes/overlay.ts +182 -0
- package/src/recipes/state.ts +70 -0
- package/src/recipes/table-row.ts +51 -0
- package/src/recipes/typography.ts +87 -0
- package/src/shared/action-field-guard.ts +41 -0
- package/src/shared/envelope.ts +207 -0
- package/src/shared/escape.ts +57 -0
- package/src/shared/kit-error.ts +21 -0
- package/src/shared/paged-list-adapter.ts +240 -0
- package/src/shared/path-guard.ts +127 -0
- package/src/shared/theme-runtime-shared.ts +175 -0
- package/src/shared/view-info.ts +10 -0
- package/src/theme/index.ts +12 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +38 -1
- package/src/theme/kit-theme.tpl +38 -1
- package/src/theme/nine-dim-structure.ts +77 -0
- package/src/theme/surface-layers.ts +97 -0
- package/src/theme/theme-tokens.ts +85 -79
- package/src/theme/theme-types.ts +71 -0
- package/src/theme/typography.ts +17 -17
- package/src/biz/shared/step-values.ts +0 -25
- package/src/biz/step-form/steps-ref.ts +0 -112
- package/src/data/options-bus.ts +0 -24
- package/src/data/prompt-dialog.ts +0 -235
- package/src/object-renderer/adopt-gate.ts +0 -333
- package/src/object-renderer/field-policy.ts +0 -89
- package/src/object-renderer/outcome-draft.ts +0 -61
- package/src/theme/nine-dim-palettes.ts +0 -1473
package/src/data/tree-table.ts
CHANGED
|
@@ -15,19 +15,22 @@
|
|
|
15
15
|
// 大数据:可见行数超过 `tree.windowThreshold` 时先画前 N 行,余下由「显示更多」每次追加 windowBatch 行(阈值与批量读设计真源)。
|
|
16
16
|
// 参考老 soma-ui:data-table 的树表(缩进、整体展开 / 收起、接口子项默认折叠的初态规则)、virtual-list 的窗口思路。
|
|
17
17
|
|
|
18
|
-
import type {
|
|
18
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
19
19
|
import { createKeyboardWiring, type CollectionItem } from 'soma-core/keyboard';
|
|
20
20
|
import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
21
21
|
import { TAG_CLASS } from '../base/tag';
|
|
22
22
|
import { permissionCheckerOf } from '../base/permission-gate';
|
|
23
23
|
import { KIT_CHECK_CLASS_CANDIDATES, attachMarkEvents, createCheck, setMarkLabel } from '../base/check-core';
|
|
24
|
-
import { CLASS_PROP, bool, displayOf, joinClass, optionsOf, str, toneOf } from '../base/shared';
|
|
24
|
+
import { CLASS_PROP, bool, createKitController, displayOf, joinClass, optionsOf, str, toneOf } from '../base/shared';
|
|
25
25
|
import { kitLocaleAt, kitText } from '../i18n/kit-text';
|
|
26
|
+
import { setKitFace } from '../recipes';
|
|
26
27
|
import { kitIcon } from '../base/icons';
|
|
27
28
|
import { KIT_TREE_TABLE } from '../object-renderer/defaults';
|
|
28
|
-
import { ACTION_BUTTON_CLASS } from '../object-renderer/table-actions';
|
|
29
|
+
import { ACTION_BUTTON_CLASS, rowBusyName, removeKeyOf } from '../object-renderer/table-actions';
|
|
30
|
+
import { isKitActionBusy, onKitActionBusy } from '../base/action-busy';
|
|
29
31
|
import { provideCtxRows } from './context-menu';
|
|
30
|
-
import {
|
|
32
|
+
import { KIT_ACTION_SLOT_BASE, actionSlotEmits, emitActionSlot } from '../base/action-slots';
|
|
33
|
+
import { unwrapEnvelope, envelopeMessage, getKitAppEnvelope } from '../shared/envelope';
|
|
31
34
|
|
|
32
35
|
// ── 类串表(整串字面量;候选类汇总在底部) ──
|
|
33
36
|
|
|
@@ -289,9 +292,12 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
289
292
|
selectClass: { type: 'string', default: '', desc: '勾选列跨度类' },
|
|
290
293
|
selected: { type: 'array', default: [], desc: '已选行数组(协调组件 focus 切片镜像)' },
|
|
291
294
|
keyField: { type: 'string', default: '', desc: '行主键字段名(比对已选行)' },
|
|
295
|
+
removeScope: { type: 'string', default: '', desc: '行在途判断用(内置删除与具名行动作共用):协调组件的作用域 id;本行在途(经忙闲通道登记)时,本行全部操作置灰、行挂 aria-busy、不抛行点击 / 勾选 / 行操作;空 = 不读' },
|
|
296
|
+
removeObject: { type: 'string', default: '', desc: '行在途判断用(内置删除与具名行动作共用):对象名,须与协调组件的主对象同名,空 = 不读;非空时行操作载荷附带 kit_object' },
|
|
297
|
+
removeKeyField: { type: 'string', default: '', desc: '行在途判断用(内置删除与具名行动作共用):行主键字段名(与协调组件登记忙态的键同一规则:显式主键 → id → 空串;独立于 keyField,不受选择影响)' },
|
|
292
298
|
actions: { type: 'array', default: [], desc: '行操作 [{ id, name, tone?, builtin?, target?, permission? }]' },
|
|
293
299
|
actionsClass: { type: 'string', default: '', desc: '操作列跨度类' },
|
|
294
|
-
pickOnRow: { type: 'boolean', default: false, desc: '点击行抛
|
|
300
|
+
pickOnRow: { type: 'boolean', default: false, desc: '点击行抛 row_pick(builtin: select)' },
|
|
295
301
|
bordered: { type: 'boolean', default: true, desc: '是否显示边框(collection.bordered: false 时移除边框类)' },
|
|
296
302
|
expandAllLabel: { type: 'string', default: '', desc: '工具条按钮文案' },
|
|
297
303
|
collapseAllLabel: { type: 'string', default: '', desc: '工具条按钮文案' },
|
|
@@ -309,25 +315,28 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
309
315
|
},
|
|
310
316
|
desc: '勾选列变化(同 KitTableActions.row_select)',
|
|
311
317
|
},
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
},
|
|
321
|
-
|
|
318
|
+
...actionSlotEmits(KIT_ACTION_SLOT_BASE.row, {
|
|
319
|
+
kit_action: { type: 'string', desc: '动作判别键' },
|
|
320
|
+
id: { type: 'string', desc: '动作 id' },
|
|
321
|
+
name: { type: 'string', desc: '动作显示名' },
|
|
322
|
+
builtin: { type: 'string', desc: '内置动作名' },
|
|
323
|
+
target: { type: 'string', desc: '目标浮层' },
|
|
324
|
+
row: { type: 'object', desc: '当前行' },
|
|
325
|
+
kit_object: { type: 'string', desc: '对象名(removeObject 非空时附带,协调组件据此认出本表所属对象)' },
|
|
326
|
+
kit_row_busy: { type: 'string', desc: '本行在途通道名(removeScope 与 removeObject 都非空时附带;动作执行器在具名行动作执行期间登记)' },
|
|
327
|
+
}, '点击行操作;载荷自带整行(同 KitTableActions.row_action_<序号>)'),
|
|
328
|
+
row_pick: {
|
|
329
|
+
payload: { kit_action: { type: 'string' }, id: { type: 'string' }, builtin: { type: 'string' }, row: { type: 'object', desc: '当前行' }, kit_object: { type: 'string', desc: '对象名(removeObject 非空时附带)' } },
|
|
330
|
+
desc: '点击行(pickOnRow);载荷自带整行(同 KitTableActions.row_pick)',
|
|
322
331
|
},
|
|
323
332
|
},
|
|
324
333
|
keyboard: { layout: 'tree', wrap: false, typeahead: false, focus_model: 'roving', space: 'activate' },
|
|
325
334
|
},
|
|
326
335
|
services: ['permission', 'http'],
|
|
327
336
|
templateHtml: `<div data-soma-id="root" class="${ROOT_CLASS}"></div>`,
|
|
328
|
-
controllerFactory: (
|
|
329
|
-
const P = (): Rec =>
|
|
330
|
-
const check = permissionCheckerOf(
|
|
337
|
+
controllerFactory: createKitController((api) => {
|
|
338
|
+
const P = (): Rec => api.props();
|
|
339
|
+
const check = permissionCheckerOf(api as unknown as any);
|
|
331
340
|
let root: HTMLElement | null = null;
|
|
332
341
|
let alive = false;
|
|
333
342
|
let forest: TreeNode[] = [];
|
|
@@ -378,7 +387,7 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
378
387
|
...(n.children.length > 0 || n.lazy ? { expanded: open.has(n.key) } : {}),
|
|
379
388
|
}));
|
|
380
389
|
|
|
381
|
-
const doc = (): Document => (root ??
|
|
390
|
+
const doc = (): Document => (root ?? api.host).ownerDocument;
|
|
382
391
|
const mk = (tag: string, cls: string, text?: string): HTMLElement => {
|
|
383
392
|
const el = doc().createElement(tag);
|
|
384
393
|
if (cls !== '') el.className = cls;
|
|
@@ -394,7 +403,7 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
394
403
|
|
|
395
404
|
const loadChildren = async (node: TreeNode): Promise<void> => {
|
|
396
405
|
const from = cfg().childrenFrom;
|
|
397
|
-
const http = (
|
|
406
|
+
const http = (api.services as { http?: HttpPort } | undefined)?.http;
|
|
398
407
|
if (!from || !http || loading.has(node.key)) return;
|
|
399
408
|
loading.add(node.key);
|
|
400
409
|
failed.delete(node.key);
|
|
@@ -404,8 +413,9 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
404
413
|
const baseURL = typeof rawBase === 'string' ? rawBase.replace(/\/+$/, '') : '/api';
|
|
405
414
|
const apiPath = baseURL && baseURL !== '/' && from.api.startsWith(`${baseURL}/`) ? from.api.slice(baseURL.length) : from.api;
|
|
406
415
|
const res = await http.get<unknown>(apiPath, { params: { [from.param]: node.key } });
|
|
407
|
-
const
|
|
408
|
-
|
|
416
|
+
const env = getKitAppEnvelope(api.host);
|
|
417
|
+
const unwrapped = unwrapEnvelope(res, env);
|
|
418
|
+
if (!unwrapped.ok) throw new Error(envelopeMessage(res, env) || kitText('soma.kit.tt_children_failed', undefined, api.host));
|
|
409
419
|
const payload = unwrapped.data;
|
|
410
420
|
let list: unknown;
|
|
411
421
|
if (Array.isArray(payload)) {
|
|
@@ -445,13 +455,34 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
445
455
|
paint();
|
|
446
456
|
};
|
|
447
457
|
|
|
458
|
+
/** 本行删除在途:协调组件经忙闲通道登记(作用域 + 对象 + 行主键三段),与 KitTableActions 同一条规则 */
|
|
459
|
+
const rowBusy = (row: Rec): boolean => {
|
|
460
|
+
const p = P();
|
|
461
|
+
const scope = str(p.removeScope);
|
|
462
|
+
const object = str(p.removeObject);
|
|
463
|
+
return scope !== '' && object !== '' && isKitActionBusy(rowBusyName(scope, object, removeKeyOf(row, str(p.removeKeyField))));
|
|
464
|
+
};
|
|
465
|
+
/** 行动作载荷附带的对象名(removeObject 非空才有) */
|
|
466
|
+
const objectPayload = (): Rec => {
|
|
467
|
+
const object = str(P().removeObject);
|
|
468
|
+
return object !== '' ? { kit_object: object } : {};
|
|
469
|
+
};
|
|
470
|
+
/** 行动作载荷附带的本行在途通道名(removeScope 与 removeObject 都非空才有;动作执行器在具名行动作执行期间登记) */
|
|
471
|
+
const rowBusyPayload = (row: Rec): Rec => {
|
|
472
|
+
const p = P();
|
|
473
|
+
const scope = str(p.removeScope);
|
|
474
|
+
const object = str(p.removeObject);
|
|
475
|
+
return scope !== '' && object !== '' ? { kit_row_busy: rowBusyName(scope, object, removeKeyOf(row, str(p.removeKeyField))) } : {};
|
|
476
|
+
};
|
|
448
477
|
const emitSelect = (row: Rec, checked: boolean): void => {
|
|
449
478
|
const mode = str(P().select, 'none');
|
|
450
479
|
if (mode !== 'single' && mode !== 'multi') return;
|
|
451
|
-
|
|
480
|
+
if (rowBusy(row)) return; // 删除在途:不抛勾选
|
|
481
|
+
api.emit('row_select', { row, checked, mode, keyField: str(P().keyField) });
|
|
452
482
|
};
|
|
453
483
|
const emitPick = (row: Rec): void => {
|
|
454
|
-
|
|
484
|
+
if (rowBusy(row)) return; // 删除在途:不抛行点击
|
|
485
|
+
api.emit('row_pick', { kit_action: 'select', id: 'select', name: '', builtin: 'select', target: '', row, ...objectPayload() });
|
|
455
486
|
};
|
|
456
487
|
const isPicked = (row: Rec): boolean => {
|
|
457
488
|
const sel = P().selected;
|
|
@@ -485,7 +516,7 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
485
516
|
/** 单元格内容:Tag(选项自带 tone)或 Text */
|
|
486
517
|
const cellContent = (cell: CellDef, row: Rec): HTMLElement => {
|
|
487
518
|
const placeholder = str(cell.props.placeholder);
|
|
488
|
-
const { text, option } = displayOf(row[cell.field], optionsOf(cell.props.options), str(cell.props.format), str(cell.props.locale, kitLocaleAt(
|
|
519
|
+
const { text, option } = displayOf(row[cell.field], optionsOf(cell.props.options), str(cell.props.format), str(cell.props.locale, kitLocaleAt(api.host) || 'zh-CN'), placeholder);
|
|
489
520
|
if (cell.component === 'Tag' && text !== '') {
|
|
490
521
|
const tone = option?.tone ?? toneOf(cell.props.tone, 'neutral');
|
|
491
522
|
return mk('span', TAG_CLASS.md[tone], text);
|
|
@@ -507,10 +538,10 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
507
538
|
if (c.expandAll && anyBranch) {
|
|
508
539
|
const barClass = p.bordered === false ? stripBorderClasses(TOOLBAR_CLASS) : TOOLBAR_CLASS;
|
|
509
540
|
const bar = mk('div', barClass);
|
|
510
|
-
const expandBtn = mk('button', TOOLBAR_BUTTON_CLASS, str(p.expandAllLabel, kitText('soma.kit.expand_all', undefined,
|
|
541
|
+
const expandBtn = mk('button', TOOLBAR_BUTTON_CLASS, str(p.expandAllLabel, kitText('soma.kit.expand_all', undefined, api.host)));
|
|
511
542
|
expandBtn.setAttribute('type', 'button');
|
|
512
543
|
expandBtn.setAttribute('data-kit-expand-all', '');
|
|
513
|
-
const collapseBtn = mk('button', TOOLBAR_BUTTON_CLASS, str(p.collapseAllLabel, kitText('soma.kit.collapse_all', undefined,
|
|
544
|
+
const collapseBtn = mk('button', TOOLBAR_BUTTON_CLASS, str(p.collapseAllLabel, kitText('soma.kit.collapse_all', undefined, api.host)));
|
|
514
545
|
collapseBtn.setAttribute('type', 'button');
|
|
515
546
|
collapseBtn.setAttribute('data-kit-collapse-all', '');
|
|
516
547
|
bar.append(expandBtn, collapseBtn);
|
|
@@ -539,16 +570,18 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
539
570
|
if (branch) row.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
|
|
540
571
|
row.tabIndex = n.key === tabbable ? 0 : -1;
|
|
541
572
|
const picked = isPicked(n.row);
|
|
573
|
+
const busy = rowBusy(n.row);
|
|
542
574
|
if (mode !== 'none') row.setAttribute('aria-selected', picked ? 'true' : 'false');
|
|
543
575
|
if (picked) row.setAttribute('data-kit-selected', '');
|
|
576
|
+
if (busy) row.setAttribute('aria-busy', 'true');
|
|
544
577
|
|
|
545
578
|
if (mode === 'single' || mode === 'multi') {
|
|
546
579
|
const selectClass = p.bordered === false ? stripBorderClasses(str(p.selectClass)) : str(p.selectClass);
|
|
547
580
|
const cell = mk('div', selectClass);
|
|
548
581
|
cell.setAttribute('role', 'gridcell');
|
|
549
|
-
const box = createCheck(doc(), mode === 'single' ? 'radio' : 'checkbox', { checked: picked });
|
|
582
|
+
const box = createCheck(doc(), mode === 'single' ? 'radio' : 'checkbox', { checked: picked, ...(busy ? { disabled: true } : {}) });
|
|
550
583
|
box.setAttribute('data-kit-sel', '');
|
|
551
|
-
setMarkLabel(box, kitText('soma.kit.select_row_of', { key: n.key },
|
|
584
|
+
setMarkLabel(box, kitText('soma.kit.select_row_of', { key: n.key }, api.host));
|
|
552
585
|
cell.appendChild(box);
|
|
553
586
|
row.appendChild(cell);
|
|
554
587
|
}
|
|
@@ -570,7 +603,7 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
570
603
|
tg.setAttribute('type', 'button');
|
|
571
604
|
tg.setAttribute('data-kit-toggle', '');
|
|
572
605
|
tg.tabIndex = -1;
|
|
573
|
-
tg.setAttribute('aria-label', failed.has(n.key) ? str(p.retryLabel, kitText('soma.kit.retry_load', undefined,
|
|
606
|
+
tg.setAttribute('aria-label', failed.has(n.key) ? str(p.retryLabel, kitText('soma.kit.retry_load', undefined, api.host)) : isOpen ? kitText('soma.kit.collapse', undefined, api.host) : kitText('soma.kit.expand', undefined, api.host));
|
|
574
607
|
wrap.appendChild(tg);
|
|
575
608
|
} else {
|
|
576
609
|
const sp = mk('span', SPACER_CLASS);
|
|
@@ -589,9 +622,15 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
589
622
|
cell.setAttribute('role', 'gridcell');
|
|
590
623
|
const box = mk('div', ACTIONS_CELL_CLASS);
|
|
591
624
|
for (const a of actions) {
|
|
592
|
-
const btn = mk('button', ACTION_BUTTON_CLASS[a.tone], a.name);
|
|
625
|
+
const btn = mk('button', ACTION_BUTTON_CLASS[a.tone], a.name) as HTMLButtonElement;
|
|
593
626
|
btn.setAttribute('type', 'button');
|
|
627
|
+
// 行动作钮:primary 实心 / neutral 描边有面标 raised;danger 是透明底幽灵钮不标
|
|
628
|
+
setKitFace(btn, a.tone === 'danger' ? null : 'raised');
|
|
594
629
|
btn.setAttribute('data-kit-act', a.id);
|
|
630
|
+
if (busy) {
|
|
631
|
+
btn.disabled = true;
|
|
632
|
+
btn.setAttribute('aria-disabled', 'true');
|
|
633
|
+
}
|
|
595
634
|
box.appendChild(btn);
|
|
596
635
|
}
|
|
597
636
|
cell.appendChild(box);
|
|
@@ -603,8 +642,9 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
603
642
|
|
|
604
643
|
if (all.length > list.length) {
|
|
605
644
|
const wrap = mk('div', MORE_WRAP_CLASS);
|
|
606
|
-
const more = mk('button', MORE_BUTTON_CLASS, kitText('soma.kit.more_rows', { label: str(p.moreLabel, kitText('soma.kit.show_more', undefined,
|
|
645
|
+
const more = mk('button', MORE_BUTTON_CLASS, kitText('soma.kit.more_rows', { label: str(p.moreLabel, kitText('soma.kit.show_more', undefined, api.host)), n: all.length - list.length }, api.host));
|
|
607
646
|
more.setAttribute('type', 'button');
|
|
647
|
+
setKitFace(more, 'raised');
|
|
608
648
|
more.setAttribute('data-kit-more', '');
|
|
609
649
|
wrap.appendChild(more);
|
|
610
650
|
root.appendChild(wrap);
|
|
@@ -613,12 +653,9 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
613
653
|
}
|
|
614
654
|
|
|
615
655
|
return {
|
|
616
|
-
|
|
617
|
-
root =
|
|
618
|
-
?? ctx.host.querySelector<HTMLElement>('[data-soma-id="root"]')
|
|
619
|
-
?? ctx.host;
|
|
656
|
+
attach(rootEl) {
|
|
657
|
+
root = rootEl;
|
|
620
658
|
alive = true;
|
|
621
|
-
sync();
|
|
622
659
|
const r = root;
|
|
623
660
|
const onClick = (event: Event): void => {
|
|
624
661
|
const t = event.target as HTMLElement | null;
|
|
@@ -646,8 +683,10 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
646
683
|
cursor = key;
|
|
647
684
|
const act = t.closest<HTMLElement>('[data-kit-act]');
|
|
648
685
|
if (act) {
|
|
649
|
-
const
|
|
650
|
-
|
|
686
|
+
const list = actionsOf(P().actions);
|
|
687
|
+
const idx = list.findIndex((x) => x.id === act.getAttribute('data-kit-act'));
|
|
688
|
+
const a = list[idx];
|
|
689
|
+
if (a && !rowBusy(node.row)) emitActionSlot((n, p) => api.emit(n, p), KIT_ACTION_SLOT_BASE.row, idx, { kit_action: a.id, id: a.id, name: a.name, builtin: a.builtin, target: a.target, row: node.row, ...objectPayload(), ...rowBusyPayload(node.row) });
|
|
651
690
|
return;
|
|
652
691
|
}
|
|
653
692
|
if (t.closest('[data-kit-toggle]')) {
|
|
@@ -677,26 +716,35 @@ export function createKitTreeTable(): SomaComponentDefinition {
|
|
|
677
716
|
};
|
|
678
717
|
r.addEventListener('click', onClick);
|
|
679
718
|
r.addEventListener('keydown', onKeydown as EventListener);
|
|
719
|
+
// 删除在途的忙闲通道:可见行里有在途状态与现状不一致才重绘
|
|
720
|
+
const offBusy = onKitActionBusy(() => {
|
|
721
|
+
if (!alive) return;
|
|
722
|
+
for (const el of rowEls()) {
|
|
723
|
+
const node = byKey.get(el.getAttribute('data-kit-key') ?? '');
|
|
724
|
+
if (node && (el.getAttribute('aria-busy') === 'true') !== rowBusy(node.row)) { api.refresh(); return; }
|
|
725
|
+
}
|
|
726
|
+
});
|
|
680
727
|
offs = [
|
|
728
|
+
offBusy,
|
|
681
729
|
() => r.removeEventListener('click', onClick),
|
|
682
730
|
offMark,
|
|
683
731
|
() => r.removeEventListener('keydown', onKeydown as EventListener),
|
|
684
732
|
// 右键菜单(页面声明了 contextMenu 才有宿主壳):按行主键取整行
|
|
685
733
|
provideCtxRows(r, (key) => byKey.get(key)?.row),
|
|
686
734
|
];
|
|
687
|
-
|
|
735
|
+
return () => {
|
|
736
|
+
alive = false;
|
|
737
|
+
for (const off of offs) off();
|
|
738
|
+
offs = [];
|
|
739
|
+
root = null;
|
|
740
|
+
};
|
|
688
741
|
},
|
|
689
|
-
|
|
742
|
+
render(rootEl) {
|
|
743
|
+
root = rootEl;
|
|
690
744
|
sync();
|
|
691
745
|
paint();
|
|
692
746
|
},
|
|
693
|
-
onUnmount(): void {
|
|
694
|
-
alive = false;
|
|
695
|
-
for (const off of offs) off();
|
|
696
|
-
offs = [];
|
|
697
|
-
root = null;
|
|
698
|
-
},
|
|
699
747
|
};
|
|
700
|
-
},
|
|
748
|
+
}),
|
|
701
749
|
};
|
|
702
750
|
}
|
package/src/data/tree.ts
CHANGED
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
// 页面重取数据把 children 补进该节点后自动结束加载态;已有的勾选会顺着级联落到新子项上。
|
|
14
14
|
// - `filter`:关键字(页面绑一个输入框的值),只留命中项 + 祖先 + 命中项的后代,祖先自动展开,命中文字高亮;无命中显示 filter_empty_text。
|
|
15
15
|
|
|
16
|
-
import type {
|
|
16
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
17
17
|
import { createKeyboardWiring, type CollectionItem } from 'soma-core/keyboard';
|
|
18
18
|
import { SOMA_SIZE_UNITS } from 'soma-foundation/theme';
|
|
19
|
-
import { bool, joinClass, str } from '../base/shared';
|
|
19
|
+
import { bool, createKitController, joinClass, str } from '../base/shared';
|
|
20
20
|
import { kitIcon } from '../base/icons';
|
|
21
21
|
import { kitText } from '../i18n/kit-text';
|
|
22
22
|
import {
|
|
23
|
-
KIT_VIRTUAL_CLASS_CANDIDATES, KIT_VIRTUAL_OPTION_ROW_CLASS,
|
|
23
|
+
KIT_VIRTUAL_CLASS_CANDIDATES, KIT_VIRTUAL_OPTION_ROW_CLASS, virtualRowPx, KIT_VIRTUAL_VIEWPORT_BASE, KIT_VIRTUAL_VIEWPORT_CLASS, KIT_VIRTUAL_VIEWPORT_DEFAULT,
|
|
24
24
|
createVirtualWindow, paintVirtualRows, rowTierOf, withoutPy, type VirtualWindow,
|
|
25
25
|
} from '../base/virtual-list';
|
|
26
26
|
import { classTokens } from './shape-util';
|
|
@@ -221,8 +221,8 @@ export function createTree(): SomaComponentDefinition {
|
|
|
221
221
|
},
|
|
222
222
|
services: ['engines'],
|
|
223
223
|
templateHtml: `<ul data-soma-id="root" role="tree" class="${ROOT_CLASS}"></ul>`,
|
|
224
|
-
controllerFactory: (
|
|
225
|
-
const P = (): Record<string, unknown> =>
|
|
224
|
+
controllerFactory: createKitController((api) => {
|
|
225
|
+
const P = (): Record<string, unknown> => api.props();
|
|
226
226
|
let root: HTMLElement | null = null;
|
|
227
227
|
let nodes: FlatNode[] = [];
|
|
228
228
|
let order: FlatNode[] = [];
|
|
@@ -303,7 +303,7 @@ export function createTree(): SomaComponentDefinition {
|
|
|
303
303
|
if (!wasOpen && node.children.length === 0 && node.pending && !loading.has(key)) {
|
|
304
304
|
loading.add(key);
|
|
305
305
|
paint();
|
|
306
|
-
|
|
306
|
+
api.emit('load', { item: node.raw });
|
|
307
307
|
return;
|
|
308
308
|
}
|
|
309
309
|
} else {
|
|
@@ -318,7 +318,7 @@ export function createTree(): SomaComponentDefinition {
|
|
|
318
318
|
selected = key;
|
|
319
319
|
cursor = key;
|
|
320
320
|
paint();
|
|
321
|
-
|
|
321
|
+
api.emit('select', { item: node.raw });
|
|
322
322
|
};
|
|
323
323
|
|
|
324
324
|
// ── 勾选 ──
|
|
@@ -382,7 +382,7 @@ export function createTree(): SomaComponentDefinition {
|
|
|
382
382
|
else if (target === 1) on.add(key); else on.delete(key);
|
|
383
383
|
recompute();
|
|
384
384
|
paint();
|
|
385
|
-
|
|
385
|
+
api.emit('check', { ...outputChecked(), item: node.raw, on: target === 1 });
|
|
386
386
|
};
|
|
387
387
|
|
|
388
388
|
const sync = (): void => {
|
|
@@ -518,10 +518,10 @@ export function createTree(): SomaComponentDefinition {
|
|
|
518
518
|
const viewport = rowTierOf(p.height, KIT_VIRTUAL_VIEWPORT_DEFAULT);
|
|
519
519
|
if (virt === null) {
|
|
520
520
|
virt = createVirtualWindow({
|
|
521
|
-
services:
|
|
521
|
+
services: api.services,
|
|
522
522
|
scroller: () => root,
|
|
523
523
|
count: visible.length,
|
|
524
|
-
rowPx:
|
|
524
|
+
rowPx: virtualRowPx(tier, r),
|
|
525
525
|
onChange: () => paint(),
|
|
526
526
|
});
|
|
527
527
|
} else {
|
|
@@ -579,7 +579,7 @@ export function createTree(): SomaComponentDefinition {
|
|
|
579
579
|
const empty = document.createElement('li');
|
|
580
580
|
empty.setAttribute('role', 'none');
|
|
581
581
|
empty.className = EMPTY_CLASS;
|
|
582
|
-
empty.textContent = str(p.filter_empty_text, kitText('soma.kit.empty_node', undefined,
|
|
582
|
+
empty.textContent = str(p.filter_empty_text, kitText('soma.kit.empty_node', undefined, api.host));
|
|
583
583
|
root.appendChild(empty);
|
|
584
584
|
} else {
|
|
585
585
|
for (const n of nodes) {
|
|
@@ -592,11 +592,8 @@ export function createTree(): SomaComponentDefinition {
|
|
|
592
592
|
}
|
|
593
593
|
|
|
594
594
|
return {
|
|
595
|
-
|
|
596
|
-
root =
|
|
597
|
-
?? ctx.host.querySelector<HTMLElement>('[data-soma-id="root"]')
|
|
598
|
-
?? ctx.host;
|
|
599
|
-
sync();
|
|
595
|
+
attach(rootEl) {
|
|
596
|
+
root = rootEl;
|
|
600
597
|
const onClick = (event: Event): void => {
|
|
601
598
|
const target = event.target as HTMLElement | null;
|
|
602
599
|
const li = target?.closest<HTMLElement>('[data-kit-key]');
|
|
@@ -625,29 +622,25 @@ export function createTree(): SomaComponentDefinition {
|
|
|
625
622
|
root.addEventListener('click', onClick);
|
|
626
623
|
root.addEventListener('keydown', onKeydown as EventListener);
|
|
627
624
|
const r = root;
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
625
|
+
const offCtx = provideCtxRows(r, (key) => {
|
|
626
|
+
const raw = byKey.get(key)?.raw;
|
|
627
|
+
return raw !== null && typeof raw === 'object' && !Array.isArray(raw) ? raw as Record<string, unknown> : undefined;
|
|
628
|
+
});
|
|
629
|
+
return () => {
|
|
630
|
+
r.removeEventListener('click', onClick);
|
|
631
|
+
r.removeEventListener('keydown', onKeydown as EventListener);
|
|
632
|
+
offCtx();
|
|
633
|
+
disposeVirt();
|
|
634
|
+
root = null;
|
|
635
|
+
};
|
|
638
636
|
},
|
|
639
|
-
|
|
637
|
+
render(rootEl) {
|
|
638
|
+
root = rootEl;
|
|
640
639
|
sync();
|
|
641
640
|
paint();
|
|
642
641
|
},
|
|
643
|
-
onUnmount(): void {
|
|
644
|
-
for (const fn of removeListeners) fn();
|
|
645
|
-
removeListeners = [];
|
|
646
|
-
disposeVirt();
|
|
647
|
-
root = null;
|
|
648
|
-
},
|
|
649
642
|
};
|
|
650
|
-
},
|
|
643
|
+
}),
|
|
651
644
|
};
|
|
652
645
|
}
|
|
653
646
|
|
package/src/data/trend-line.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
// 无障碍:role=img,aria-label 汇总最近值 / 最高 / 最低。点数不足 2 显示空态短横。
|
|
7
7
|
// 同一份折线也被 StatGroup 的 `spark` 项复用(`sparklineSvg`)。
|
|
8
8
|
|
|
9
|
-
import type {
|
|
10
|
-
import { bool, joinClass, num, str } from '../base/shared';
|
|
9
|
+
import type { SomaComponentDefinition } from 'soma-core';
|
|
10
|
+
import { bool, createKitController, joinClass, type KitProps, num, str } from '../base/shared';
|
|
11
11
|
import { classTokens, mk, rowsOf, textOf } from './shape-util';
|
|
12
12
|
import { SPARKLINE_MAX_POINTS } from './d9-limits';
|
|
13
13
|
|
|
@@ -111,12 +111,8 @@ export function createTrendLine(): SomaComponentDefinition {
|
|
|
111
111
|
emits: {},
|
|
112
112
|
},
|
|
113
113
|
templateHtml: `<div data-soma-id="root" class="${ROOT_CLASS}"></div>`,
|
|
114
|
-
controllerFactory: (
|
|
115
|
-
|
|
116
|
-
let root: HTMLElement | null = null;
|
|
117
|
-
const paint = (): void => {
|
|
118
|
-
if (!root) return;
|
|
119
|
-
const p = P();
|
|
114
|
+
controllerFactory: createKitController((_api) => ({
|
|
115
|
+
render(root: HTMLElement, p: KitProps): void {
|
|
120
116
|
root.className = joinClass(ROOT_CLASS, p.class);
|
|
121
117
|
root.textContent = '';
|
|
122
118
|
const values = trendValuesOf(p.data, str(p.y, 'value'));
|
|
@@ -127,21 +123,7 @@ export function createTrendLine(): SomaComponentDefinition {
|
|
|
127
123
|
className: 'size-full',
|
|
128
124
|
});
|
|
129
125
|
if (svg) root.appendChild(svg); else root.appendChild(mk('span', EMPTY_CLASS, str(p.empty_text, '–')));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
onMount(): void {
|
|
133
|
-
root = ctx.host.querySelector<HTMLElement>('[data-soma-scoped-id="root"]')
|
|
134
|
-
?? ctx.host.querySelector<HTMLElement>('[data-soma-id="root"]')
|
|
135
|
-
?? ctx.host;
|
|
136
|
-
paint();
|
|
137
|
-
},
|
|
138
|
-
onPropsChange(): void {
|
|
139
|
-
paint();
|
|
140
|
-
},
|
|
141
|
-
onUnmount(): void {
|
|
142
|
-
root = null;
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
},
|
|
126
|
+
},
|
|
127
|
+
})),
|
|
146
128
|
};
|
|
147
129
|
}
|