@lblod/ember-rdfa-editor-lblod-plugins 38.2.0 → 38.3.0

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/addon/components/lmb-plugin/insert.ts +11 -5
  3. package/addon/components/variable-plugin/date/{date-time-picker.ts → date-picker.gts} +46 -42
  4. package/addon/components/variable-plugin/date/date-time-picker.gts +42 -0
  5. package/addon/components/variable-plugin/date/{edit.ts → edit.gts} +176 -11
  6. package/addon/components/variable-plugin/date/floating-date-container.gts +54 -0
  7. package/addon/components/variable-plugin/date/time-picker.gts +61 -0
  8. package/addon/components/variable-plugin/person/edit.ts +15 -41
  9. package/addon/plugins/lmb-plugin/index.ts +84 -0
  10. package/addon/plugins/location-plugin/contextual-actions/index.ts +11 -5
  11. package/addon/plugins/location-plugin/utils/replace-location.ts +2 -30
  12. package/addon/plugins/variable-plugin/contextual-actions/person.ts +140 -0
  13. package/addon/plugins/variable-plugin/utils/replace-person.ts +64 -0
  14. package/addon/plugins/variable-plugin/variables/person.ts +30 -1
  15. package/addon/{plugins/location-plugin/utils/get-document-locations.ts → utils/get-ranked-pnodes.ts} +34 -34
  16. package/addon/utils/move-node-selection-forward.ts +27 -0
  17. package/app/styles/variable-plugin.scss +10 -0
  18. package/declarations/addon/components/lmb-plugin/insert.d.ts +1 -1
  19. package/declarations/addon/components/variable-plugin/date/date-picker.d.ts +44 -0
  20. package/declarations/addon/components/variable-plugin/date/date-time-picker.d.ts +11 -27
  21. package/declarations/addon/components/variable-plugin/date/edit.d.ts +15 -12
  22. package/declarations/addon/components/variable-plugin/date/floating-date-container.d.ts +21 -0
  23. package/declarations/addon/components/variable-plugin/date/time-picker.d.ts +22 -0
  24. package/declarations/addon/components/variable-plugin/person/edit.d.ts +3 -6
  25. package/declarations/addon/plugins/lmb-plugin/index.d.ts +11 -0
  26. package/declarations/addon/plugins/location-plugin/contextual-actions/index.d.ts +2 -7
  27. package/declarations/addon/plugins/variable-plugin/contextual-actions/person.d.ts +4 -0
  28. package/declarations/addon/plugins/variable-plugin/utils/replace-person.d.ts +5 -0
  29. package/declarations/addon/plugins/variable-plugin/variables/person.d.ts +4 -0
  30. package/declarations/addon/utils/get-ranked-pnodes.d.ts +6 -0
  31. package/declarations/addon/utils/move-node-selection-forward.d.ts +2 -0
  32. package/package.json +2 -2
  33. package/translations/en-US.yaml +4 -0
  34. package/translations/nl-BE.yaml +6 -0
  35. package/addon/components/variable-plugin/date/date-time-picker.hbs +0 -26
  36. package/addon/components/variable-plugin/date/edit.hbs +0 -113
  37. package/declarations/addon/plugins/location-plugin/utils/get-document-locations.d.ts +0 -4
@@ -1,34 +1,18 @@
1
1
  import Component from '@glimmer/component';
2
2
  import Intl from 'ember-intl/services/intl';
3
- type Args = {
4
- value?: Date;
5
- onChange: (date: Date) => void;
3
+ type Sig = {
4
+ Args: {
5
+ value?: Date | null;
6
+ onlyDate?: boolean;
7
+ showSeconds?: boolean;
8
+ onChange: (date: Date) => void;
9
+ };
10
+ Blocks: {
11
+ default: [];
12
+ };
6
13
  };
7
- export default class DateTimePickerComponent extends Component<Args> {
14
+ export default class DateTimePickerComponent extends Component<Sig> {
8
15
  intl: Intl;
9
16
  date?: Date;
10
- get hours(): number | undefined;
11
- get minutes(): number | undefined;
12
- get seconds(): number | undefined;
13
- get datePickerLocalization(): {
14
- buttonLabel: string;
15
- selectedDateMessage: string;
16
- prevMonthLabel: string;
17
- nextMonthLabel: string;
18
- monthSelectLabel: string;
19
- yearSelectLabel: string;
20
- closeLabel: string;
21
- calendarHeading: string;
22
- dayNames: string[];
23
- monthNames: string[];
24
- monthNamesShort: string[];
25
- placeholder: string;
26
- };
27
- onChangeDate(_isoDate: unknown, date: Date): void;
28
- onChangeTime(timeObject: {
29
- hours: number;
30
- minutes: number;
31
- seconds: number;
32
- }): void;
33
17
  }
34
18
  export {};
@@ -5,17 +5,15 @@ import IntlService from 'ember-intl/services/intl';
5
5
  import { Option } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/option';
6
6
  import { DateFormat, DateOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables/date';
7
7
  import { ValidationError } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
8
- import { Velcro } from 'ember-velcro';
9
- import AuCard from '../../_private/appuniversum-overrides/au-card';
10
- type Args = {
11
- controller: SayController;
12
- options: DateOptions;
8
+ import { TOC } from '@ember/component/template-only';
9
+ type Sig = {
10
+ Args: {
11
+ controller: SayController;
12
+ options: DateOptions;
13
+ };
14
+ Element: HTMLDivElement;
13
15
  };
14
- export default class DateEditComponent extends Component<Args> {
15
- CrossIcon: import("@ember/component/template-only").TOC<import("@appuniversum/ember-appuniversum/components/icons/cross").CrossIconSignature>;
16
- InfoCircleIcon: import("@ember/component/template-only").TOC<import("@appuniversum/ember-appuniversum/components/icons/info-circle").InfoCircleIconSignature>;
17
- Velcro: typeof Velcro;
18
- AuCard: typeof AuCard;
16
+ export declare class DateEditComponent extends Component<Sig> {
19
17
  intl: IntlService;
20
18
  helpModalOpen: boolean;
21
19
  tooltipOpen: boolean;
@@ -34,15 +32,20 @@ export default class DateEditComponent extends Component<Args> {
34
32
  get isCustomAllowed(): boolean;
35
33
  get dateFormatType(): string;
36
34
  get customDateFormatError(): ValidationError | null;
35
+ get hasCustomDateFormatError(): boolean;
37
36
  get humanError(): string | null;
38
37
  get pickerDate(): Option<Date>;
38
+ get pickerHours(): number | undefined;
39
+ get pickerMinutes(): number | undefined;
40
+ get pickerSeconds(): number | undefined;
39
41
  showTooltip(): void;
40
42
  hideTooltip(): void;
41
43
  changeDate(date: Date): void;
42
44
  changeIncludeTime(includeTime: boolean): void;
43
45
  setDateFormat(dateFormat: string, custom?: boolean): void;
44
- setDateFormatFromKey(formatKey: string): void;
46
+ setDateFormatFromKey(formatKey?: string): void;
45
47
  setCustomDateFormat(event: InputEvent): void;
46
48
  toggleHelpModal(): void;
47
49
  }
48
- export {};
50
+ declare const DateEditCardComponent: TOC<Sig>;
51
+ export default DateEditCardComponent;
@@ -0,0 +1,21 @@
1
+ import Component from '@glimmer/component';
2
+ import { NodeSelection, SayController } from '@lblod/ember-rdfa-editor';
3
+ import { DateOptions } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables';
4
+ type Signature = {
5
+ Args: {
6
+ controller: SayController;
7
+ options: DateOptions;
8
+ };
9
+ Blocks: {
10
+ default: [];
11
+ };
12
+ };
13
+ export default class FloatingDateContainer extends Component<Signature> {
14
+ get editorState(): import("@lblod/ember-rdfa-editor").EditorState;
15
+ get selectedDateNode(): {
16
+ value: import("prosemirror-model").Node;
17
+ pos: number;
18
+ } | null;
19
+ get forSelection(): NodeSelection | null;
20
+ }
21
+ export {};
@@ -0,0 +1,22 @@
1
+ import Component from '@glimmer/component';
2
+ import Intl from 'ember-intl/services/intl';
3
+ type Sig = {
4
+ Args: {
5
+ value?: Date | null;
6
+ showSeconds?: boolean;
7
+ onChange: (date: Date) => void;
8
+ };
9
+ };
10
+ export default class TimePickerComponent extends Component<Sig> {
11
+ intl: Intl;
12
+ date?: Date;
13
+ onChangeTime(timeObject: {
14
+ hours: number;
15
+ minutes: number;
16
+ seconds: number;
17
+ }): void;
18
+ get hours(): number | undefined;
19
+ get minutes(): number | undefined;
20
+ get seconds(): number | undefined;
21
+ }
22
+ export {};
@@ -1,19 +1,16 @@
1
1
  import Component from '@glimmer/component';
2
- import { SayController, PNode } from '@lblod/ember-rdfa-editor';
2
+ import { SayController } from '@lblod/ember-rdfa-editor';
3
+ import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
3
4
  import { LmbPluginConfig } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/lmb-plugin';
4
5
  import Electee from '@lblod/ember-rdfa-editor-lblod-plugins/models/electee';
5
6
  type Args = {
6
7
  controller: SayController;
7
8
  config: LmbPluginConfig;
8
9
  };
9
- type PersonNode = {
10
- node: PNode;
11
- pos: number;
12
- };
13
10
  export default class PersonEditComponent extends Component<Args> {
14
11
  showModal: boolean;
15
12
  get controller(): SayController;
16
- get selectedPersonNode(): PersonNode | undefined;
13
+ get selectedPersonNode(): ResolvedPNode | undefined;
17
14
  get showCard(): boolean;
18
15
  get isEditing(): boolean;
19
16
  openModal(): void;
@@ -1,9 +1,20 @@
1
1
  import { SayController } from '@lblod/ember-rdfa-editor';
2
2
  import { BestuursperiodeLabel } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/constants';
3
3
  import { Person } from '../variable-plugin/variables';
4
+ import { ProsePlugin, PluginKey, EditorState, EditorView, Command } from '@lblod/ember-rdfa-editor';
4
5
  export type LmbPluginConfig = {
5
6
  endpoint: string;
6
7
  defaultPeriod?: BestuursperiodeLabel;
7
8
  defaultAdminUnit?: string;
8
9
  };
9
10
  export declare function createPersonNode(controller: SayController, person: Person): import("prosemirror-model").Node;
11
+ type PluginState = {
12
+ modalOpen: boolean;
13
+ };
14
+ export declare const lmbModalsPluginKey: PluginKey<PluginState>;
15
+ export declare function closeLmbModal(view: EditorView): void;
16
+ export declare function openLmbModal(view: EditorView): void;
17
+ export declare function openLmbModalCommand(): Command;
18
+ export declare function lmbModalsPlugin(): ProsePlugin<PluginState>;
19
+ export declare function getLmbModalsPluginState(state: EditorState): PluginState | undefined;
20
+ export {};
@@ -1,9 +1,4 @@
1
1
  import { EditorState } from '@lblod/ember-rdfa-editor';
2
- import { ContextualActionGroup } from '@lblod/ember-rdfa-editor/plugins/contextual-actions';
3
- export declare function getContextualActions(type: 'suggestions' | 'other_elements'): (state: EditorState, searchQuery?: string) => {
4
- label: string;
5
- id: string;
6
- group: string;
7
- command: import("@lblod/ember-rdfa-editor").Command;
8
- }[];
2
+ import { ContextualAction, ContextualActionGroup } from '@lblod/ember-rdfa-editor/plugins/contextual-actions';
3
+ export declare function getContextualActions(type: 'suggestions' | 'other_elements'): (state: EditorState, searchQuery?: string) => ContextualAction[];
9
4
  export declare function getContextualActionGroups(): (state: EditorState) => ContextualActionGroup[];
@@ -0,0 +1,4 @@
1
+ import { EditorState } from '@lblod/ember-rdfa-editor';
2
+ import { ContextualActionGroup } from '@lblod/ember-rdfa-editor/plugins/contextual-actions';
3
+ import { LmbPluginConfig } from '../../lmb-plugin';
4
+ export declare function getPersonActionGroups(args: LmbPluginConfig): (state: EditorState) => ContextualActionGroup[];
@@ -0,0 +1,5 @@
1
+ import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
2
+ import { EditorState, Command } from '@lblod/ember-rdfa-editor';
3
+ import { Person } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/variables/person';
4
+ export declare function getReplacePersonTransaction(state: EditorState, personNode: ResolvedPNode, newPerson: Person): import("@lblod/ember-rdfa-editor/utils/transaction-utils").TransactionCombinatorResult<unknown>;
5
+ export declare function replacePersonCommand(node: ResolvedPNode, newPerson: Person): Command;
@@ -1,7 +1,11 @@
1
+ import { PNode } from '@lblod/ember-rdfa-editor';
1
2
  export type Person = {
2
3
  uri: string;
3
4
  firstName: string;
4
5
  lastName: string;
5
6
  };
7
+ export declare function getPersonFromPNode(node: PNode): (Person & {
8
+ fullName: string;
9
+ }) | null;
6
10
  export declare const person_variable: import("@lblod/ember-rdfa-editor/core/say-node-spec").default;
7
11
  export declare const personVariableView: (controller: import("@lblod/ember-rdfa-editor").SayController) => import("@lblod/ember-rdfa-editor").NodeViewConstructor;
@@ -0,0 +1,6 @@
1
+ import { EditorState, type PNode } from '@lblod/ember-rdfa-editor';
2
+ import { ResolvedPNode } from '@lblod/ember-rdfa-editor/utils/_private/types';
3
+ export declare function getRankedPNodes(state: EditorState, nodeType: string, getUri: (node: PNode) => string): {
4
+ node: ResolvedPNode;
5
+ score: number;
6
+ }[];
@@ -0,0 +1,2 @@
1
+ import { Selection, type PNode } from '@lblod/ember-rdfa-editor';
2
+ export declare function moveNodeSelectionForward(selection: Selection, doc: PNode): Selection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lblod/ember-rdfa-editor-lblod-plugins",
3
- "version": "38.2.0",
3
+ "version": "38.3.0",
4
4
  "description": "Ember addon providing lblod specific plugins for the ember-rdfa-editor",
5
5
  "keywords": [
6
6
  "ember-addon",
@@ -110,7 +110,7 @@
110
110
  "@glint/ember-tsc": "^1.5.0",
111
111
  "@glint/environment-ember-loose": "^1.5.0",
112
112
  "@glint/environment-ember-template-imports": "^1.5.0",
113
- "@lblod/ember-rdfa-editor": "13.16.0",
113
+ "@lblod/ember-rdfa-editor": "13.16.0-dev.7794d286b071182b48aea581cb16221fca22c8d1",
114
114
  "@glint/template": "^1.7.7",
115
115
  "@rdfjs/to-ntriples": "^3.0.1",
116
116
  "@rdfjs/types": "^2.0.1",
@@ -238,6 +238,10 @@ variable-plugin:
238
238
  person:
239
239
  card-title: Insert person
240
240
  nodeview-placeholder: Person
241
+ suggestions: Suggestions
242
+ other-elements: Other elements
243
+ advanced-search: Advanced search…
244
+ searching: Searching…
241
245
  autofill:
242
246
  autofillKey: Autofill Key
243
247
  convertToString: Replace variable node with plain text on text insertion
@@ -242,6 +242,10 @@ variable-plugin:
242
242
  person:
243
243
  card-title: Persoon invoegen
244
244
  nodeview-placeholder: Persoon
245
+ suggestions: Suggesties
246
+ other-elements: Andere elementen
247
+ advanced-search: Geavanceerd zoeken…
248
+ searching: Aan het zoeken…
245
249
  autofill:
246
250
  autofillKey: Sleutelwaarde
247
251
  convertToString: Vervang variabele door platte tekst bij invoegen
@@ -431,7 +435,9 @@ lmb-plugin:
431
435
  placeholder: bv. Gent, Aalst...
432
436
  fields:
433
437
  name: Naam
438
+ status: Status
434
439
  kandidatenlijst: Kandidatenlijst
440
+ role: Rol
435
441
  period: Bestuursperiode
436
442
  adminUnit: Bestuurseenheid
437
443
 
@@ -1,26 +0,0 @@
1
- {{! @glint-nocheck: not typesafe yet }}
2
- <AuFormRow>
3
- <AuDatePicker
4
- @onChange={{this.onChangeDate}}
5
- @value={{this.date}}
6
- @label={{t 'date-plugin.card.label'}}
7
- @localization={{this.datePickerLocalization}}
8
- />
9
- </AuFormRow>
10
- {{yield}}
11
- {{#unless @onlyDate}}
12
- <AuFormRow>
13
- <AuTimePicker
14
- @hoursLabel={{t 'date-plugin.card.hours'}}
15
- @minutesLabel={{t 'date-plugin.card.minutes'}}
16
- @secondsLabel={{t 'date-plugin.card.seconds'}}
17
- @nowLabel={{t 'date-plugin.card.now'}}
18
- @hours={{this.hours}}
19
- @minutes={{this.minutes}}
20
- @seconds={{this.seconds}}
21
- @showSeconds={{@showSeconds}}
22
- @showNow={{true}}
23
- @onChange={{this.onChangeTime}}
24
- />
25
- </AuFormRow>
26
- {{/unless}}
@@ -1,113 +0,0 @@
1
- {{! @glint-nocheck: not typesafe yet }}
2
- <div>
3
- {{#if this.showCard}}
4
- <this.AuCard
5
- @shadow={{true}}
6
- @size='flush'
7
- {{! @glint-ignore: backwards compat with AU v3, remove if not supported anymore}}
8
- @disableAuContent={{true}}
9
- as |c|
10
- >
11
- <c.header class='au-u-hidden-visually'>
12
- <AuHeading @level='3' @skin='6'>{{t
13
- 'date-plugin.card.title'
14
- }}</AuHeading>
15
- </c.header>
16
- <c.content class='au-o-box au-o-box--small'>
17
- <div class='au-o-flow au-o-flow--small'>
18
- <VariablePlugin::Date::DateTimePicker
19
- @onChange={{this.changeDate}}
20
- @value={{this.pickerDate}}
21
- @onlyDate={{this.onlyDate}}
22
- @showSeconds={{this.showSeconds}}
23
- >
24
-
25
- <AuFormRow @alignment='inline'>
26
- <AuCheckbox
27
- @name='include-time'
28
- @disabled={{eq this.dateFormatType 'custom'}}
29
- @checked={{not this.onlyDate}}
30
- @onChange={{this.changeIncludeTime}}
31
- >
32
- {{t 'date-plugin.card.include-time'}}
33
- </AuCheckbox>
34
- {{#if this.isCustom}}
35
- <this.Velcro
36
- @placement='top'
37
- @strategy='absolute'
38
- @offsetOptions={{hash mainAxis=10}}
39
- as |velcro|
40
- >
41
- <AuBadge
42
- @size='small'
43
- @icon={{this.InfoCircleIcon}}
44
- aria-describedby='date-plugin-time-info-tooltip'
45
- {{velcro.hook}}
46
- {{on 'mouseenter' this.showTooltip}}
47
- {{on 'mouseleave' this.hideTooltip}}
48
- {{on 'focus' this.showTooltip}}
49
- {{on 'blur' this.hideTooltip}}
50
- />
51
- {{#if this.tooltipOpen}}
52
- <AuPill
53
- id='date-plugin-time-info-tooltip'
54
- role='tooltip'
55
- {{velcro.loop}}
56
- >
57
- {{t 'date-plugin.card.info-custom-time'}}
58
- </AuPill>
59
- {{/if}}
60
- </this.Velcro>
61
- {{/if}}
62
- </AuFormRow>
63
- </VariablePlugin::Date::DateTimePicker>
64
- <AuRadioGroup
65
- @name='dateFormat'
66
- @selected={{this.dateFormatType}}
67
- @onChange={{this.setDateFormatFromKey}}
68
- as |Group|
69
- >
70
- {{#each this.formats as |format|}}
71
- <Group.Radio @value={{format.key}}>
72
- {{if
73
- format.label
74
- format.label
75
- (if this.onlyDate format.dateFormat format.dateTimeFormat)
76
- }}
77
- </Group.Radio>
78
- {{/each}}
79
- {{#if this.isCustomAllowed}}
80
- <Group.Radio @value='custom'>
81
- {{t 'date-plugin.card.custom-date'}}
82
- </Group.Radio>
83
- {{/if}}
84
- </AuRadioGroup>
85
- {{#if (eq this.dateFormatType 'custom')}}
86
- <AuFormRow @alignment='post'>
87
- <AuButton
88
- @skin='secondary'
89
- @icon={{this.InfoCircleIcon}}
90
- {{on 'click' this.toggleHelpModal}}
91
- />
92
- <AuNativeInput
93
- @error={{this.customDateFormatError}}
94
- value={{this.documentDateFormat}}
95
- {{on 'input' this.setCustomDateFormat}}
96
- />
97
- </AuFormRow>
98
- {{#if this.humanError}}
99
- <AuPill
100
- @skin='error'
101
- @icon={{this.CrossIcon}}
102
- >{{this.humanError}}</AuPill>
103
- {{/if}}
104
- {{/if}}
105
- </div>
106
- </c.content>
107
- </this.AuCard>
108
- {{/if}}
109
- </div>
110
- <VariablePlugin::Date::HelpModal
111
- @modalOpen={{this.helpModalOpen}}
112
- @closeModal={{this.toggleHelpModal}}
113
- />
@@ -1,4 +0,0 @@
1
- import { EditorState } from '@lblod/ember-rdfa-editor';
2
- import { Area, Place } from './geo-helpers';
3
- import { Address } from './address-helpers';
4
- export default function getDocumentLocations(state: EditorState): (Address | Place | Area)[];