@yongdall/web 0.4.0 → 0.4.2

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/index.d.mts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as dot_request1 from "dot-request";
2
2
  import DotRequest, { default as DotRequest$1 } from "dot-request";
3
3
  import { ArrayStore, BindObjectStore, ObjectStore, Schema, Schema as Schema$1, Store, Store as Store$1, StoreLayout, StoreLayout as StoreLayout$1, renderStore } from "@neeloong/form";
4
- import { Hook, Indicator, Plugin, Search } from "@yongdall/common";
5
4
  import { Field, MaybePromise, Permission, Permissions } from "@yongdall/types";
5
+ import { Hook, Indicator, Plugin, Search } from "@yongdall/common";
6
6
  import { Signal as Signal$1 } from "signal-polyfill";
7
- export * from "@yongdall/common";
8
7
  export * from "@yongdall/types";
8
+ export * from "@yongdall/common";
9
9
 
10
10
  //#region \0rolldown/runtime.js
11
11
  //#endregion
@@ -97,6 +97,12 @@ declare function createComputed<T>(get: () => T, set?: (newValue: T) => void): S
97
97
  * @returns {T}
98
98
  */
99
99
  declare function createDeeply<T extends Record<string, any>>(state: State<T>, struct: Record<string, any>): T;
100
+ /**
101
+ *
102
+ * @param {number} interval
103
+ * @param {AbortSignal} [signal]
104
+ */
105
+ declare function createTick(interval: number, signal?: AbortSignal): State<number>;
100
106
  type State<T> = {
101
107
  get: () => T;
102
108
  set: (newValue: T) => void;
@@ -597,7 +603,7 @@ declare namespace Print {
597
603
  /**
598
604
  * - 文本对齐
599
605
  */
600
- textAlign?: "left" | "right" | "center" | "justify" | "start" | "end" | undefined;
606
+ textAlign?: "left" | "center" | "right" | "justify" | "start" | "end" | undefined;
601
607
  /**
602
608
  * - 垂直对齐
603
609
  */
@@ -711,12 +717,7 @@ type PageConfiguration = {
711
717
  title?: string | undefined;
712
718
  titlePattern?: string | undefined;
713
719
  config?: Record<string, any> | undefined;
714
- fields?: {
715
- field?: string;
716
- label?: string;
717
- width?: number;
718
- pattern?: string;
719
- }[] | undefined;
720
+ fields?: Field.Show[] | undefined;
720
721
  sides?: {
721
722
  widget: string;
722
723
  options: string;
@@ -1022,17 +1023,7 @@ type FieldScript = {
1022
1023
  label?: ((store: Store$1) => string) | null | undefined;
1023
1024
  description?: ((store: Store$1) => string) | null | undefined;
1024
1025
  placeholder?: ((store: Store$1) => string) | null | undefined;
1025
- step?: ((store: Store$1) => string) | null | undefined;
1026
- max?: ((store: Store$1) => string) | null | undefined;
1027
- min?: ((store: Store$1) => string) | null | undefined;
1028
1026
  validator?: Schema$1.Validator | Schema$1.Validator[] | null | undefined;
1029
- validators?: {
1030
- input?: Schema$1.AsyncValidator | Schema$1.AsyncValidator[] | null | undefined;
1031
- change?: Schema$1.AsyncValidator | Schema$1.AsyncValidator[] | null | undefined;
1032
- click?: Schema$1.AsyncValidator | Schema$1.AsyncValidator[] | null | undefined;
1033
- focus?: Schema$1.AsyncValidator | Schema$1.AsyncValidator[] | null | undefined;
1034
- blur?: Schema$1.AsyncValidator | Schema$1.AsyncValidator[] | null | undefined;
1035
- } | undefined;
1036
1027
  };
1037
1028
  //#endregion
1038
1029
  //#region packages/web/route/PageHandle.d.mts
@@ -1272,9 +1263,73 @@ declare namespace Command {
1272
1263
  };
1273
1264
  }
1274
1265
  //#endregion
1275
- //#region packages/web/form/buildSource/index.d.mts
1276
- type Source = Field.Source & Source.Extends;
1277
- declare namespace Source {
1266
+ //#region packages/web/DataSource/index.d.mts
1267
+ /**
1268
+ *
1269
+ * @param {any[] | Field.Source | null} [source]
1270
+ * @param {string | null} [model]
1271
+ * @param {Store | null} [store]
1272
+ * @returns {DataSource}
1273
+ */
1274
+ declare function buildDataSource(source?: any[] | Field.Source | null, model?: string | null, store?: Store$1 | null): DataSource;
1275
+ type DataSource = {
1276
+ /**
1277
+ * id字段(或模式)
1278
+ */
1279
+ id?: string | null | undefined;
1280
+ /**
1281
+ * 标签字段(或模式)
1282
+ */
1283
+ label?: string | null | undefined;
1284
+ /**
1285
+ * 值字段(或模式)
1286
+ */
1287
+ value?: string | null | undefined;
1288
+ /**
1289
+ * 父节点字段(或模式)
1290
+ */
1291
+ parent?: string | null | undefined;
1292
+ /**
1293
+ * 子列表
1294
+ */
1295
+ children?: string | null | undefined;
1296
+ /**
1297
+ * 序列字段
1298
+ */
1299
+ sequence?: string | null | undefined;
1300
+ /**
1301
+ * 禁用字段
1302
+ */
1303
+ disabled?: string | null | undefined;
1304
+ /**
1305
+ * 显示字段
1306
+ */
1307
+ fields?: Field.Show[] | null | undefined;
1308
+ /**
1309
+ * 快速过滤字段
1310
+ */
1311
+ queryFilters?: {
1312
+ field: string;
1313
+ label?: string;
1314
+ operator: string;
1315
+ }[] | null | undefined;
1316
+ /**
1317
+ * 字段配置信息
1318
+ */
1319
+ configurator: any;
1320
+ labels: {
1321
+ [x: string]: string;
1322
+ };
1323
+ options: DataSource.Option[];
1324
+ levelTree: (DataSource.Option & {
1325
+ level: number;
1326
+ })[];
1327
+ map: Record<string, any>;
1328
+ model?: string | null | undefined;
1329
+ where: (Search.Match | Search.Children)[];
1330
+ orWhere: (Search.Match | Search.Children | Search.Or)[];
1331
+ };
1332
+ declare namespace DataSource {
1278
1333
  type Option = {
1279
1334
  id: string | number;
1280
1335
  value: string | number;
@@ -1282,18 +1337,7 @@ declare namespace Source {
1282
1337
  data: any;
1283
1338
  parentId?: string | number | undefined;
1284
1339
  disabled?: boolean | undefined;
1285
- children: Source.Option[];
1286
- };
1287
- type Load = () => State<Source.Option[]>;
1288
- type Extends = {
1289
- labels: {
1290
- [x: string]: string;
1291
- };
1292
- options: Source.Option[];
1293
- levelTree: (Source.Option & {
1294
- level: number;
1295
- })[];
1296
- map: Record<string, any>;
1340
+ children: DataSource.Option[];
1297
1341
  };
1298
1342
  }
1299
1343
  //#endregion
@@ -1302,6 +1346,8 @@ interface CurrentPage {
1302
1346
  title: string;
1303
1347
  icon: string;
1304
1348
  print: Print;
1349
+ unsaved: boolean;
1350
+ loading: boolean;
1305
1351
  }
1306
1352
  interface VerifyError {
1307
1353
  focus(): void;
@@ -1335,7 +1381,7 @@ interface FieldContext {
1335
1381
  readonly placeholder: string;
1336
1382
  readonly description: string;
1337
1383
  readonly signal: AbortSignal;
1338
- readonly source: Source;
1384
+ readonly source: DataSource;
1339
1385
  listen<K extends keyof FieldComponentEvent>(event: K, listen: FieldComponentEvent[K]): () => void;
1340
1386
  emit(event: string, e: any): void;
1341
1387
  readonly bind?: ((data: any) => void) | null;
@@ -1344,7 +1390,7 @@ interface ConfiguratorContext extends FieldContext {
1344
1390
  root: HTMLElement;
1345
1391
  }
1346
1392
  interface FieldComponent<T extends Record<string, any> = Record<string, any>> {
1347
- (ctx: FieldContext, options?: T): HTMLElement;
1393
+ (ctx: FieldContext, options?: T): Element;
1348
1394
  }
1349
1395
  interface ConfiguratorComponent<T extends Record<string, any> = Record<string, any>> {
1350
1396
  (ctx: ConfiguratorContext, options?: T): void;
@@ -1397,7 +1443,7 @@ interface FieldFilterContext {
1397
1443
  readonly operator: string;
1398
1444
  value: any;
1399
1445
  readonly signal: AbortSignal;
1400
- readonly source: Source;
1446
+ readonly source: DataSource;
1401
1447
  readonly destroyed: boolean;
1402
1448
  }
1403
1449
  interface FieldFilterComponent<T extends Record<string, any> = Record<string, any>> {
@@ -1869,13 +1915,13 @@ declare function showFilterDialog(modelDefine: ModelScriptConfiguration, value?:
1869
1915
  //#region packages/web/form/createStoreField.d.mts
1870
1916
  /**
1871
1917
  *
1872
- * @param {Store} store
1918
+ * @param {Store<any, Field?, any>} store
1873
1919
  * @param {FieldStyle} style
1874
1920
  * @param {any} [renderer]
1875
1921
  * @param {StoreLayout.Options?} [options]
1876
- * @returns {HTMLElement?}
1922
+ * @returns {Element?}
1877
1923
  */
1878
- declare function createStoreField(store: Store$1, style: FieldStyle, renderer?: any, options?: StoreLayout$1.Options | null): HTMLElement | null;
1924
+ declare function createStoreField(store: Store$1<any, Field | null, any>, style: FieldStyle, renderer?: any, options?: StoreLayout$1.Options | null): Element | null;
1879
1925
  //#endregion
1880
1926
  //#region packages/web/utils/toUrl.d.mts
1881
1927
  /**
@@ -1917,7 +1963,7 @@ declare namespace code128_d_exports {
1917
1963
  *
1918
1964
  * @param {string} text
1919
1965
  */
1920
- declare function encode$1(text: string): any[];
1966
+ declare function encode$1(text: string): (0 | 1)[];
1921
1967
  //#endregion
1922
1968
  //#region packages/web/script/index.d.mts
1923
1969
  /**
@@ -1952,25 +1998,37 @@ declare function formLayoutsService(layout: string): {
1952
1998
  then<TResult1 = {
1953
1999
  layout: any;
1954
2000
  type?: string;
2001
+ enableLink?: boolean;
2002
+ enableLinkEditable?: boolean;
1955
2003
  } | null, TResult2 = never>(onfulfilled?: ((value: {
1956
2004
  layout: any;
1957
2005
  type?: string;
2006
+ enableLink?: boolean;
2007
+ enableLinkEditable?: boolean;
1958
2008
  } | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
1959
2009
  catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<{
1960
2010
  layout: any;
1961
2011
  type?: string;
2012
+ enableLink?: boolean;
2013
+ enableLinkEditable?: boolean;
1962
2014
  } | TResult2 | null>;
1963
2015
  finally(onfinally?: (() => void) | null | undefined): Promise<{
1964
2016
  layout: any;
1965
2017
  type?: string;
2018
+ enableLink?: boolean;
2019
+ enableLinkEditable?: boolean;
1966
2020
  } | null>;
1967
2021
  load: (force?: boolean) => Promise<{
1968
2022
  layout: any;
1969
2023
  type?: string;
2024
+ enableLink?: boolean;
2025
+ enableLinkEditable?: boolean;
1970
2026
  } | null>;
1971
2027
  get: () => {
1972
2028
  layout: any;
1973
2029
  type?: string;
2030
+ enableLink?: boolean;
2031
+ enableLinkEditable?: boolean;
1974
2032
  } | null;
1975
2033
  };
1976
2034
  //#endregion
@@ -2429,4 +2487,4 @@ declare function updateHooks(hooks: Record<string, Hook.Define<Hooks>>): void;
2429
2487
  /** @type {Hook<Hooks>} */
2430
2488
  declare const allHooks: Hook<Hooks>;
2431
2489
  //#endregion
2432
- export { ArrayStore, Authenticator, BindObjectStore, code128_d_exports as Code128, Command, ConfiguratorComponent, ConfiguratorContext, type ContinuationDefine, CurrentPage, DotRequest, FieldComponent, FieldComponentEvent, FieldComponents, FieldContext, FieldDefine, FieldFilter, FieldFilterComponent, FieldFilterContext, FieldFilterFns, FieldFilterOptions, FieldFilterStyle, type FieldScript, type FieldScriptConfiguration, FieldShowHandle, FieldStyle, FilterFns, FormFieldHook, FromRenderer, GeneralContext, type HomeContext, Hooks, IconDefine, Ident_d_exports as Ident, List, type Match, Menu, type ModelConfiguration, ModelIndicator, type ModelScript, type ModelScriptConfiguration, ObjectStore, Page, type PageContext, type PageError, PageFooter, type PageHandle, PageHeader, PageIdent, type PageManager, type PageRenderer, PageSection, PageSectionParam, PageSider, Pagination, type Print, ResponseError, type Schema, Signal$1 as Signal, type Source, State, Store, type StoreLayout, SubmodelsLayoutEvent, Theme, User, UserHook, VerifyContext, VerifyError, type WorkspaceDefine, addManager, allHooks, application, buildPlugin, createComputed, createDeeply, createFilters, createIcon, createQuickFilters, createShowField, createState, createStore, createStoreField, effect, enumerationsService, execScript, filterPermission, formLayoutsService, getAllFilterFns, getAuthorizations, getField, getFieldFilter, getFieldFilterOperators, getFilterFns, getPages, getPermissionFields, getPrimaryFields, hasField, hasFieldFilter, importStyle, importWidget, isPluginId, loadMenu, modelService, neverAbortedSignal, pathRoots, _default as permissionsService, plugins, _default$1 as renderForm, renderStore, _default$2 as renderStoreForm, request, root$1 as root, selectFile, setIcon, showFilterDialog, start, testPermission, testPermissionConstraints, testPermissions, toFileLink, toFileURL, toId, toSchema, toUrl, updateHooks, waitAbortSignal, watch };
2490
+ export { ArrayStore, Authenticator, BindObjectStore, code128_d_exports as Code128, Command, ConfiguratorComponent, ConfiguratorContext, type ContinuationDefine, CurrentPage, type DataSource, DotRequest, FieldComponent, FieldComponentEvent, FieldComponents, FieldContext, FieldDefine, FieldFilter, FieldFilterComponent, FieldFilterContext, FieldFilterFns, FieldFilterOptions, FieldFilterStyle, type FieldScript, type FieldScriptConfiguration, FieldShowHandle, FieldStyle, FilterFns, FormFieldHook, FromRenderer, GeneralContext, type HomeContext, Hooks, IconDefine, Ident_d_exports as Ident, List, type Match, Menu, type ModelConfiguration, ModelIndicator, type ModelScript, type ModelScriptConfiguration, ObjectStore, Page, type PageConfiguration, type PageContext, type PageError, PageFooter, type PageHandle, PageHeader, PageIdent, type PageManager, type PageRenderer, PageSection, PageSectionParam, PageSider, Pagination, type Print, ResponseError, type Schema, Signal$1 as Signal, State, Store, type StoreLayout, SubmodelsLayoutEvent, Theme, User, UserHook, VerifyContext, VerifyError, type WorkspaceDefine, addManager, allHooks, application, buildDataSource, buildPlugin, createComputed, createDeeply, createFilters, createIcon, createQuickFilters, createShowField, createState, createStore, createStoreField, createTick, effect, enumerationsService, execScript, filterPermission, formLayoutsService, getAllFilterFns, getAuthorizations, getField, getFieldFilter, getFieldFilterOperators, getFilterFns, getPages, getPermissionFields, getPrimaryFields, hasField, hasFieldFilter, importStyle, importWidget, isPluginId, loadMenu, modelService, neverAbortedSignal, pathRoots, _default as permissionsService, plugins, _default$1 as renderForm, renderStore, _default$2 as renderStoreForm, request, root$1 as root, selectFile, setIcon, showFilterDialog, start, testPermission, testPermissionConstraints, testPermissions, toFileLink, toFileURL, toId, toSchema, toUrl, updateHooks, waitAbortSignal, watch };